CFD Online Discussion Forums

CFD Online Discussion Forums (
-   STAR-CCM+ (
-   -   Macro to access java files in sub-directory (

abraum December 5, 2011 17:57

Macro to access java files in sub-directory
Hey Folks,

I am new to STAR-CCM+ as well as Java programming (I do have c++ experience). I created a macro to run a simulation which tries to reference a support class in a sub-directory. (I use the helper class to set variables such as the save location, save name, CSV export names, etc. I mainly want to compartmentalize my code for organization purposes. My hope is that future, much larger macros can be broken down into smaller files making it easier to switch on and off functionality.)

I have messed around with some simple java files and and can access metods the sub-directories by importing:
import macro.MySubDirectory.*;

And likewise put the correct package header in the java file in the sub-directory:
package macro.MySubDirectory;

STAR-CCM+ then complains that it cannot find that class in the sub-directory:
package macro.MySubDirectory does not exist
cannot find symbol
symbol: class MyHelperClass
location: class macro.MyModifiedStarMacro

Is STAR-CCM+ not capable of reading in (importing) other java classes in the same or sub-directories? If not, then is there a nice way to organize the larger macros?

abdul099 January 2, 2012 21:12

Create a .jar file (or multiple) containing your helper classes, put them somewhere and enter this path as user macro classpath (Tools -> Options)

abraum January 24, 2012 15:25

Thanks Abdul! I got it to work once I pointed STAR to a compiled .JAR file. Cheers!

trsakthipriya July 11, 2012 02:46

Thank you
Thank you very much.... I was run into the same problem, after seeing this post issue has been resolved.

All times are GMT -4. The time now is 11:57.