Results 1 to 3 of 3
  1. #1
    newbie123 is offline Member
    Join Date
    Nov 2009
    Posts
    90
    Rep Power
    0

    Default Java environmental variables

    I recently had to deal with a configuration problem on a Windows machine.

    This got me thinking about Java environmental variables, e.g., JAVA_HOME, CLASSPATH, JRE_HOME.

    Is there a comprehensive list of these variables? And what are they specifically used for. For example, JAVA_HOME and CLASSPATH are pretty obvious, but when is JRE_HOME used? When the JDK is not install but only the JRE?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Java environmental variables

    JAVA_HOME and JRE_HOME are used by some Java apps (eg Tomcat) so they know where Java is installed. The former should point to a JDK and the latter to a JRE.
    They aren't needed for your own stuff unless your own stuff needs to know where to find Java.

    CLASSPATH is the fallback for where the JVM looks to find classes when it is asked to run a program.
    You should generally not use the CLASSPATH environment variable other than declaring in a batch file (ie local to an execution call). You'll normally either use that BAT file or you'd use the -cp (-classpath) switch for java/javac to tell it where your classes are located.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    newbie123 is offline Member
    Join Date
    Nov 2009
    Posts
    90
    Rep Power
    0

    Default Re: Java environmental variables

    Thanks Tolls for the clarification.

Similar Threads

  1. Replies: 2
    Last Post: 08-26-2012, 02:49 AM
  2. Replies: 1
    Last Post: 04-16-2012, 02:07 PM
  3. Linux - Reading custom environmental variables
    By colton in forum Advanced Java
    Replies: 0
    Last Post: 10-28-2011, 09:51 PM
  4. Replies: 2
    Last Post: 06-26-2010, 10:18 PM
  5. What are Instance variables and static variables?
    By sandeshforu in forum New To Java
    Replies: 3
    Last Post: 09-09-2009, 06:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •