4

Most unix commands whose operation changes based on values of environment variables have a section "ENVIRONMENT VARIABLES" in their man page. No such luck for the java binary (Sun/Oracle Java 6), though I'm fairly certain that things like CLASSPATH and perhaps JVM_OPTS have an effect.

Can anyone point me to a list of environment variables that affect the 'java' binary?

Brian Gruber
  • 626
  • 7
  • 11

4 Answers4

2

I don't think there are that many, but it will depend on what implementation (oracle vs ibm).

IBM's JDK has a list here: http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/topic/com.ibm.java.doc.diagnostics.50/diag/appendixes/env_var/env_jvm.html

The oracle JDK has, at the very least, CLASSPATH, JAVA_HOME and JRE_HOME. Although in the man page for "java", the only environment variable it mentions is CLASSPATH.

Other tools like ant or tomcat may look for JVM_OPTS, and JBoss uses JAVA_OPTS.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • yep, that link is exactly what i want, except I want it for Oracle. – Brian Gruber Nov 23 '11 at 20:20
  • 1
    I think the only one that the "java" binary cares about it **CLASSPATH** (based on the man page). Any listing from Oracle seems to want you to use command line options. – Jon Lin Nov 23 '11 at 20:40
0

Incomplete answer to my own question:

Oracle has a list for Java 8 of env variables to include when reporting a bug. Not really documentation, and no guarantee it's complete, but it is highly suggestive:

  • JAVA_HOME
  • JRE_HOME
  • JAVA_TOOL_OPTIONS
  • _JAVA_OPTIONS
  • CLASSPATH
  • JAVA_COMPILER

There is specific documentation on JAVA_HOME and JAVA_TOOL_OPTIONS

Brian Gruber
  • 626
  • 7
  • 11
0

Setting JAVA_HOME to the installation directory and adding $JAVA_HOME/bin to the PATH sould be enough, if you don't have to configure build systems like maven or ant.

CLASSPATH is required on most start scripts to contain the location of supporting libraries (.jar) or third-party stuff.

JAVA_OPTS usualy contains parameters for setting heap-space, debug agent and things like that.

AFAIK java itself does not depend on environment settings, rather start scripts, init services and anything build around.

Thus you won't find a single list of all environment variables related to java (software-products).

stacker
  • 68,052
  • 28
  • 140
  • 210
  • Is `JAVA_HOME` actually a specified JRE envvar? As opposed to a convention application / appserver authors seem to agree on unanimously as a way of choosing the location of the JRE to use? – millimoose Nov 23 '11 at 20:06
  • @Inerdial I think it is rather a convention, than a technical requirement. – stacker Nov 23 '11 at 20:18
  • This is not helpful; I am specifically asking about the java binary. I am perfectly aware that wrapper scripts may look at whatever environment variables they want to. – Brian Gruber Nov 23 '11 at 20:20
0

There is also _JAVA_OPTIONS, mentioned here, which works for all JVM invocations, including applets and Webstart.

prunge
  • 22,460
  • 3
  • 73
  • 80