Why is java not found on the command line after I’ve installed it?

The Problem

A common problem we have reported from users of SeqMonk is that when they try to launch the program on a Windows system they get an error message saying that java could not be found, even though they have installed this and they can show that it works fine in their browser.

When SeqMonk looks for java it’s actually testing whether the command shell has been configured such that running “java -version” returns a valid java version identifier.  If you run this on a system with java correctly installed you should get something like this:

C:\Users\andrewss>java -version
java version “1.7.0_13”
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

However on a machine where java has not been correctly installed to the command line you’ll get something like this:

C:\Users\andrewss>java -version
‘java’ is not recognized as an internal or external command,
operable program or batch file.

The Reason

If you’ve installed java and the installation completed successfully with no errors, but you still can’t access the java program on the command line then the most likely cause is that there is a mismatch between the version of java you have and your operating system.  Most PCs these days ship with a 64-bit operating system, and this is able to run both 64-bit and 32-bit programs.  Java also comes in 64-bit and 32-bit versions, and both of these can run on 64-bit windows (32-bit windows can only run 32-bit java).

If you are using java to run local programs then you generally want to run the 64-bit version of java since it gives you access to more of your system’s memory and includes other efficiencies.  For historical reasons though Oracle don’t link to the 64-bit verison of java on their default download page, so it’s very easy to be led into installing the 32 bit version of java.  For some applications this won’t matter, but as secondary consequence of this is that installing the 32-bit version of java on a 64-bit windows system will not install the java program onto the command line, so although it will work in a browser it won’t work in your command shell and programs such as SeqMonk won’t find it.

The Solution

The quick fix for this problem is to install the 64 bit version of java.  You can install this alongside the 32 bit version and the can coexist happily so anything which does need the 32 bit version (some browsers still might) can still use it, but the 64 bit version will then work on the command line and you will be able to access all of your system’s memory in the java programs you run.

The path you need to take to get this to work is shown below:

Java Front ScreenFirst, go to java.com, and click on the link which says “Free Java Download”

 

 

 

 

 

 

See all Java DownloadsOn the next screen ignore the link which says “Agree and Start Free Download”, but instead look for, and click, the smaller link below which says “See all Java downloads”

 

 

 

 

Java 64 DownloadFrom the list on the next page you should find and click the option which says “Windows Offline (64-bit)”.  This will download the correct version of java which, once installed, should allow you to run command line java programs correctly.

 

 

Date
Categories
Tags
Permalink
Status

Published:September 9, 2013

Computing

Bookmark the permalink

Both comments and trackbacks are currently closed.


One Trackback

  • By 2014 DOWNLOAD WINDOWS JAVA on September 11, 2013 at 2:47 am

    […] Why is java not found on the command line after I've installed it? […]