views:

2091

answers:

3

I'm in the situation where I've installed the JDK, but I can't run applets in browsers (I may not have installed the JRE).

However, when I install the JRE, it clobbers my JDK as the default runtime. This breaks pretty much everything (eclipse, ant) - as they require a server JVM.

There's no JAVA_HOME system property these days - it just seems to use some registry magic (setting the system path is of no use either). Previously, I've just uninstalled the JRE after I've used it to restore the JDK. This time I want to fix it properly.

This also manifests itself with the jre autoupdater - once upon a time, I had a working setup with the JDK and JRE, but it updated and bust everything.

+1  A: 

Check this thread:

http://forums.sun.com/thread.jspa?threadID=645735

Every SDK installs a JRE - it would be hard to develop otherwise. You had a problem with your setup from the start.

cdonner
> You had a problem with your setup from the start. No I didn't. I think what must have happened is the computer already had a JRE. I installed a JDK+JRE and it was fine: until the initial JRE auto-updated itself and then all hell broke loose.
Stephen
Hmm. The link is good, but your answer is not... When the JDK installs the JRE, it ends up with the same problem.
Stephen
+3  A: 

This is a bit of a pain on Windows. Here's what I do.

Install latest Sun JDK 6u11(?) in path like c:\install\jdk\sun\6u11, then let the installer install public JRE in the default place (c:\program files\blah). This will setup your default JRE for the majority of things.

Install older JDKs as necessary, like 5u18 in c:\install\jdk\sun\5u18, but don't install the public JREs.

When in development, I have a little batch file that I use to setup a command prompt for each JDK version. Essentially just set JAVA_HOME=c:\jdk\sun\JDK_DESIRED and then set PATH=%JAVA_HOME%\bin;%PATH%. This will put the desired JDK first in the path and any secondary tools like Ant or Maven can use the JAVA_HOME variable. The path is important because most public JRE installs put a linked executable at c:\WINDOWS\System32\java.exe, which usually overrides most other settings.

nbeyer
The key was to put the desired java/bin as the first thing in the system path.
Stephen
A: 

I have several JDK (1.4, 1.5, 1.6) installed in C:\Java with their JREs. Then I let Sun update the public JRE in C:\Program Files\Java Lately there is an improvement, installing in jre6. Previously, there was a different folder per new version (1.5.0_4, 1.5.0_5, etc.), which was taking lot of space

PhiLho