How to install standard Java installation / runtime (Windows)?

I am in a situation where I installed the JDK, but I can not run applets in browsers (maybe I did not install the JRE).

However, when I install the JRE, it compresses my JDK as the default runtime. This greatly violates everything (eclipse, ant) ​​- since they require a JVM server.

There is no JAVA_HOME system property these days - it seems that it uses some registry magic (setting the system path is also useless). I used to just uninstall the JRE after using it to restore the JDK. This time I want to fix it right.

This also shows up in jre autoupdater - once upon a time, I had a working setup with the JDK and JRE, but it was updated and it messed up.

+41
java windows installation runtime
Feb 15 '09 at 21:54
source share
6 answers

This is a bit of a pain in Windows. That's what I'm doing.

Install the latest version of Sun JDK, for example. 6u11 , in a path like c:\install\jdk\sun\6u11 , then install the installer's public JRE in the default location ( c:\program files\blah ). This will allow you to configure a standard JRE for most things.

Install the old JDKs as needed, for example 5u18 in c:\install\jdk\sun\5u18 , but do not install the public JREs.

During development, I have a small batch file that I use to install the command line for each version of the JDK. 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 on the path, and any secondary tools, such as Ant or Maven, can use the JAVA_HOME variable.

The path is important because most open JRE installations put the associated executable in c:\WINDOWS\System32\java.exe , which usually overrides most other parameters.

+37
Feb 15 '09 at 22:10
source share

I fixed the behavior of my eclipse launcher shortcut in the properties dialog

of

 "E:\Program Files\eclipse\eclipse.exe" 

to

 "E:\Program Files\eclipse\eclipse.exe" -vm "E:\Program Files\Java\jdk1.6.0_30\bin" 

as described in the Eclipse documentation

This is only a patch, as it depends on the shortcut to fix the situation ...

An alternative is to permanently set the parameter in the eclipse initialization file.

+5
Jan 16 '12 at 2:21
source share

I had this problem (Java 1.8 vs. Java 9 on Windows 7) and my findings:

short version

seems by default (due to path input)

 c:\ProgramData\Oracle\Java\javapath\java -version 

select the version you need (test, use the tab ending in cmd, not sure what these numbers represent), I had 2 options, see the more detailed version for more information

 c:\ProgramData\Oracle\Java\javapath_target_[tab] 

remove the connection / link and the link to your version (the one that ends with 181743567 in my case for Java 8)

 rmdir javapath mklink /D javapath javapath_target_181743567 

longer version:

Reinstall Java 1.8 after Java 9 does not work. The installation sequence was jdk1.8.0_74, jdk-9.0.4 and tried to make Java 8 by default using jdk1.8.0_162 ...

After installing jdk1.8.0_162, I still have

 java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode) 

What I see along the way

 Path=...;C:\ProgramData\Oracle\Java\javapath;... 

So, I checked what it is and I found that this is a connection (link)

 c:\ProgramData\Oracle\Java>dir Volume in drive C is OSDisk Volume Serial Number is DA2F-C2CC Directory of c:\ProgramData\Oracle\Java 2018-02-07 17:06 <DIR> . 2018-02-07 17:06 <DIR> .. 2018-02-08 17:08 <DIR> .oracle_jre_usage 2017-08-22 11:04 <DIR> installcache 2018-02-08 17:08 <DIR> installcache_x64 2018-02-07 17:06 <JUNCTION> javapath [C:\ProgramData\Oracle\Java\javapath_target_185258831] 2018-02-07 17:06 <DIR> javapath_target_181743567 2018-02-07 17:06 <DIR> javapath_target_185258831 

These hashes don't ring, but when I checked

 c:\ProgramData\Oracle\Java\javapath_target_181743567>.\java -version java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode) c:\ProgramData\Oracle\Java\javapath_target_185258831>.\java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode) 

to enable Java 8 again, I had to remove the link as described here

 rmdir javapath 

and recreate with java i wanted

 mklink /D javapath javapath_target_181743567 

tested:

 c:\ProgramData\Oracle\Java>java -version java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode) 
+2
Feb 08 '18 at 16:25
source share

I just install all the versions of the JDK that I need, and the last installation becomes standard, so I just reinstall the one I need by default, if necessary.

+1
Jan 25 '18 at 17:05
source share

I have several JDKs (1.4, 1.5, 1.6) installed in C: \ Java with my JREs. Then I let Sun update the public JRE in C: \ Program Files \ Java Recently, there has been an improvement installing in jre6. Previously, there was another folder for the new version (1.5.0_4, 1.5.0_5, etc.), which took up a lot of space

0
Feb 15 '09 at 22:48
source share

After many attempts, I found the transition approach more convenient. This is very similar to how this problem is solved in Linux.

It basically consists of a link between c:\tools\java\default and the actual version of java that you want to use by default on your system.




How to install:

  • Download the connection and don't forget to put it in your PATH environment variable
  • Set the environment like this: - PATH , pointing to ONLY this jre c:\tools\java\default\bin - JAVA_HOME , pointing to `c: \ tools \ java \ default
  • Save all your jre-s in one folder (if you do this in your Program Plles folder, you may encounter some
    • C:\tools\Java\JRE_1.6
    • C:\tools\Java\JRE_1.7
    • C:\tools\Java\JRE_1.8
  • Open a command prompt and cd to C:\tools\Java\
  • Run junction default JRE_1.6

This will create a connection (which is more or less like a symlink in linux) between c:\tools\java\default and C:\tools\Java\JRE_1.6

This way you will always have java by default in c:\tools\java\default .

If you need to change the default java version to version 1.8, you just need to execute

 junction -d default junction default JRE_1.8 

Then you can have batch files for this without the command line, for example set_jdk8.bat set_jdk7.bat

As suggested by @ ΣΡŸΤΡ–

EDIT: From a Vista window, you can use mklink /J default JRE_1.8

0
Dec 21 '15 at 13:35
source share



All Articles