Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running 64 bit Windows 7 on a quad core machine. When I run java -version in a command window, I get

java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

I was having an issue where jar files wouldn't open when I tried to run them. I searched my drive for java.exe, and I found many copies of it. Most are in subfolders of program folders. I found one java.exe that was only 20K. Most others are in the 2000K range, but vary in both size and date.

Is it safe to get rid of any of these? How does a program determine which copy of java.exe (or javaw.exe) to run? Can I safely clean any of this up?

share|improve this question

Keep all of them.

If there is a java.exe in a subfolder of a program folder, it is probably safe to assume that the program whose folder java.exe is in uses that version of it.

A computer isn't restricted to only having one executable file in the whole system with a given name. It's no different than having, say, two Word documents with the same name: they have to be in different folders, but they don't conflict. When the program tries to open it, it knows what folder to look in. Oftentimes, the programmer will manually say where to look (e.g., "run bin/java.exe"). Other times, it will look in an OS-provided list of folders where it might find executables. Either one is possible; if a program comes bundled with java.exe, it is very likely the former.

In general, if a program comes bundled with something like java.exe, you should probably assume that there's a reason why it uses that specific java.exe. Don't just go around deleting files from program directories. It can end very badly.

share|improve this answer

Yeah, keep as many as you want/need. You can have several different versions of Java installed on a single box, and, in addition, tools/applications may ship with their own versions.

Look at where the various versions are stored (what directory) to determine why they are there. Some may be installed in a Java directory such as C:\"Program Files"\Java\jdk1.7.0_07\bin\ and others may be installed in the directories of specific applications.

To find out which one is "active" when you issue a java command from the command line, type echo %path% in a Command Prompt and note what Java directory is listed.

(And note that if you delete a version of java.exe there's almost certainly a (much larger) set of JAR files nearby that should probably be deleted as well, if your intent is to save disk space.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .