Version Confusion

I just ran a file jre-1_5_0_06-windows-i586-p.exe succesfully. It appears to have installed in c:\program files\java

When I type at the command prompt > java -version it returns

java version "1.3.1_01"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)

Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

When I try to compile:

C:\Program Files\Java\jre1.5.0_06\bin>javac HelloWorldApp.java

Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'

has value '1.5', but '1.3' is required.

Error: could not find java.dll

Error: could not find Java 2 Runtime Environment.

My question is what do I need to do to be able to compile this simple program? I would like to unistall all or previous versions, but I don't know how to do that.

[853 byte] By [JavaNoviceForSurea] at [2007-11-27 0:45:26]
# 1

It might be that the older version of Java is first in your PATH environment variable. (Go to control panel -> system -> advanced -> environment variables). Look at your PATH and make sure the newer version of Java appears first. (You can also at a DOS prompt type echo %PATH%).

- Saish

Saisha at 2007-7-11 23:10:36 > top of Java-index,Java Essentials,New To Java...
# 2

I had modified the path variable and even tried compiling the .java file directly in the new jre folder, but still recieved the same error. What is javaw.exe vs. javac.exe?

Still perplexed..

C:\>echo %PATH%

c:\Program Files\Java\jre1.5.0_06\bin;C:\orant\bin;c:\Oracle9i\bin;c:\Oracle9i\jre\1.3.1\bin;c:\Oracle9i\jre\1.4.0\bin;C

:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys

JavaNoviceForSurea at 2007-7-11 23:10:36 > top of Java-index,Java Essentials,New To Java...
# 3

Ok. If you want to compile a Java class, you need the JDK (which also has a JRE installed). If you simply want to run a compiled class, you only need the JRE. Did you install the full-blown JDK 1.5? If not, do so. Make sure that PATH points to the home directory of the installation (followed by 'bin'). Make sure that the environment variable JAVA_HOME points to the root of the installation (without 'bin').

Examples:

JAVA_HOME c:\java\jdk1.5

PATH c:\java\jdk1.5\bin

- Saish

Saisha at 2007-7-11 23:10:36 > top of Java-index,Java Essentials,New To Java...