Lyndon Armitage

Lyndon is a Developer at IDR Solutions. He currently focuses mostly on the JavaScript in the Viewer and PDF to HTML5 Converter and also the Android PDF Viewer. He gave a short talk at the GlassFish UnConference before JavaOne 2012.

Outside of IDR Solutions he has a keen interest in AI and Games Programming and runs a blog that he periodically updates.

Why installing Java 8 may ‘break’ your system

2 min read

In writing our PDF to Android PDF Viewer application I needed to ensure the source files we output are correct and work in popular IDEs with minimum fuss. This is what lead me to discover a little gotcha in Windows to do with how Java installs itself and what version you may be running in some situations.

When you install a version of Java it also copies over the files: java.exe, javaws.exe and javaw.exe to your Windows system32 folder. This isn’t entirely odd behaviour as it ensures Java will run without having to touch your PATH environment variable. However it can be an issue if you install the developer preview of JDK 8 and then try to run a fresh install of the IDE Eclipse; as at the time of writing you will be confronted with the cryptic error message:

An internal error occurred during: “Contacting Software Sites”.
org/eclipse/ecf/core/identity/ID

eclipseInstallErrorUpon attempting to Install New Software.

After some looking around my hard drive and checking of my Java version (I have a very new computer as my work station but I still have quite a few JDKs installed) I found that the command line was returning:

C:\Users\Lyndon>java -version
 java version "1.8.0-ea"
 Java(TM) SE Runtime Environment (build 1.8.0-ea-b76)
 Java HotSpot(TM) 64-Bit Server VM (build 25.0-b17, mixed mode)

Even though my PATH variable and JAVA_HOME were pointing at C:\Program Files\Java\jdk1.7.0_11\bin and C:\Program Files\Java\jdk1.7.0_11 respectively.

Upon a quick Google search using the correct keywords I came across a stack overflow question that was related to my experience from 2011 (in fact I found two, but only one had useful answers). In it the person explained that the Java installer would copy several executable files to your system32 folder so that Java would run fine without being set in the PATH (personally I’d prefer it if the installer didn’t do this).

They also stated that these copied executable files are never updated by Java’s auto updates (which may be changed now, although my files were not overwritten with the latest auto update) and recommended removing Java using the control panel and reinstalling with the latest version. Another person suggested replacing the files entirely.

What I did instead was to simply remove the .exe files from my system32 folder and then run java -version again, and to my delight it now used the correct JDK from my PATH variable and Eclipse did not encounter the error message any more. I didn’t even have to open a new command line window.

C:\Users\Lyndon>java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

I’ve yet to encounter any bugs with my other Java based as they all appear to be using the correct PATH as well but I have the executables backed up just in case.

A better solution that I later tried was to change the order of my PATH environment variable so that my reference to the JDK was before:

%SystemRoot%\system32;

This solves the problem without deleting any files.

For the original stack overflow question I came across on this issue see here, it isn’t exactly related to my circumstance with JDK8 but does describe what’s going on quite well.

Have you encountered any other odd bugs or gotchas with the Java installer on windows that you’d care to share?

Lyndon Armitage

Lyndon is a Developer at IDR Solutions. He currently focuses mostly on the JavaScript in the Viewer and PDF to HTML5 Converter and also the Android PDF Viewer. He gave a short talk at the GlassFish UnConference before JavaOne 2012.

Outside of IDR Solutions he has a keen interest in AI and Games Programming and runs a blog that he periodically updates.

2 Replies to “Why installing Java 8 may ‘break’ your system”

  1. There’s another Java 8 installation problem I’ve recently encountered with java-1.8_20. Direct calls to “%SystemRoot%\system32\java.exe” will no longer work since the installer now creates symlimks to the executables in “%ProgramData%\Oracle\Java\javapath”. JDK-8043453

  2. This happened to me today. I tried you “better solution.” It saved my bacon! Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *