0

I am having some difficulty.

I am trying to set the path on a machine, i have set Java_Home to C:\Program Files\Java\jdk1.4.2_01\bin

and Path to C:\Program Files\Java\jdk1.4.2_01\bin;C:\Program Files\Common...

yet whenever i do java -version in cmd i get

Java(TM) 2 Runtime Environment, Standard Edition (build
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

any ideas why this might be?

Thanks

2
  • because 1.4 at work is our standard build now... and yes i know , we re still in the dark ages! Commented Aug 12, 2011 at 12:28
  • 1
    You can select to build against a lower revision of the Java language with a more modern JRE / JDK. I'm sure that it complicates things more than building off of all matching revisions, but nobody's fixed a bug in 1.4 forever (nor will they). Commented Aug 12, 2011 at 12:39

3 Answers 3

2

First, JAVA_HOME should be set (if it is set) to the root directory of the Java installation, or in your case

C:\Program Files\Java\jdk1.4.2_01

Second, JAVA_HOME is an older way of letting programs know where Java resides. It should be set more for "backwards compatibility" and less for "making it work".

The Path then should have an entry

${JAVA_HOME}\bin

And it is the additional "bin" on the path that will allow the executables to be found. Make sure that this java executable is found on your path first, and you will see a difference in output

Finally, unless you absolutely need Java 1.4, an upgrade is recommended.

Sign up to request clarification or add additional context in comments.

2 Comments

i only have the jre and not the jdk - i assume this is an issue too right?
Yes, if you only have the JRE, the JAVA_HOME is still the root of the JRE, and include the subdirectory "bin" on your path. Remember it has to be before other possible matching "java" commands. The first match will always be selected to run, well, first.
1

You don't have to care about JAVA_HOME as it is not needed to run Java. It's used by some applications.

Check your path for additional entries that contain a jdk/jre. Move your PATH values to the front of the current path.

If you've changed the PATH environment variable in windows (through the dialogs), make sure that you spawn a new console because running consoles will not pick up global changes...

Comments

0

JAVA_HOME should be set to C:\Program Files\Java\jdk1.4.2_01, and the path should contain both C:\Program Files\Java\jdk1.4.2_01\bin and C:\Program Files\Java\jdk1.4.2_01\jre\bin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.