Labels

Thursday, July 12, 2012

Confusion forJava SDK and JRE ?

On Windows, you may actually have two Java environments in different places on your computer. The JDK (or SDK, whatever you want to call it) is usually installed in a directory like \jdk1.2.2. The JRE, including the Java Plug-in, is typically installed in a directory like \Program Files\JavaSoft\JRE\1.2.
This becomes a problem whenever you are installing standard extension libraries or editing files like the java.security properties file. The problem I usually have goes something like this: I install a standard extension library, like the Communications API or the Java Cryptography Extension, in \jdk1.2.2\jre\lib\ext. I work on a program that uses the extension API, and it compiles fine. When I go to run it, it complains that the classes in the standard extension library are not found.
The problem is that I'm compiling using \jdk1.2.2\bin\javac.exe, but when I run the thing, it uses \winnt\java.exe, which is actually the JRE, which would expect to find the extension API in \Program Files\JavaSoft\JRE\1.2\jre\lib\ext.
To fix this, I usually remove or rename java.exe and javaw.exe in \winnt. Then when I run my program, it uses \jdk1.2.2\bin\java.exe which is the Java SDK where I installed the standard extension API.

No comments:

Post a Comment