Forums > Java

setting environment variables in MAX

May 28, 2008 | 8:46 pm

Hello,

I have a jar file, which runs fine in a shell, that I want to use in MAX. Running the jar from an MXJ object, certain environment variables are not properly set. Is there a way for MAX to set these? I was thinking maybe there is a max.jvm.option you could put in the max.java.config.text that will set the desired values. Other possibilities are welcome.

thanks,
-eric


May 30, 2008 | 5:30 pm

I believe environment variables are read-only in Java. They have to be set in the environment before you run a Java process. I’m not aware of a way to do this in Max.

If your Java program is running another process, then I think you can change them for that process. But not for the current process. More info at http://java.sun.com/docs/books/tutorial/essential/environment/env.html

Usually the standard way to pass environment variable-like settings to Java is to use system properties. These are changeable inside Java, and could also be set with the -Dname=value option in the max.java.config file.

So are you sure you really need environment variables, or would system properties work?

If it has to be environment variables, and you are on OS X, I maybe you could use the environment.plist file? http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_Technology_Overview/CommandLine/chapter_950_section_4.html


Viewing 2 posts - 1 through 2 (of 2 total)