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 wanted to run java programs on a 64 bit Windows 7 computer and I have a 64 bit Java VM. How do I launch the jar files via command line ? It seems that 64 bit Windows 7 have a seperation between 32 bits and 64 bits programs.

share|improve this question

migrated from stackoverflow.com Sep 4 '11 at 12:24

This question came from our site for professional and enthusiast programmers.

4  
sounds like a question for superuser, have you tried java -jar file.jar In case you have more than one JRE try giving the explicit path (C:\Programs\..., "C:\Programs (x86)\...") – mbx Sep 4 '11 at 9:04
3  
Does java -jar /path/to/jar/jarFile.jar work? – James Webster Sep 4 '11 at 9:04

Try giving the explicit path for each JRE you have installed:

  • "C:\Program Files\Java\jre7\bin\java.exe" -jar yourfile.jar
  • "C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar yourfile.jar
  • "C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar yourfile.jar

Make sure you have a 64 bit JRE and a 32 bit JRE. Most java software provided still needs a 32 bit JRE (as it uses JNI or other non-portable stuff).

share|improve this answer
    
What do you mean by "is still 32 bit"? – Thorbjørn Ravn Andersen Sep 4 '11 at 9:24
    
Having installed just a 64bit JDK/JRE I realized, that many projects still provide binaries that require a 32 bit JRE (JDownloader, JXplorer) so I had to compile myself or simply install a 32bit JRE as well. – mbx Sep 4 '11 at 9:34
1  
Not unless they link in native code, like SWT. A pure java program can be run unmodified on any Java SE JVM. – Thorbjørn Ravn Andersen Sep 4 '11 at 9:46
    
@Thorbjørn Ravn Andersen: if you provide features, someone will use them. Same case here. I don't want to look at the sources of every minor tool just to make sure that it runs on any JRE. I also run (closed source) apps having a "java-frontend" with a C++ backend using JNI. – mbx Sep 4 '11 at 9:52
    
Thanks this worked out for me (Win7 64bit). What suprises me the most, that a command like java -jar my_awesome_jar.jar does work in the console (cmd) but not in the run field (Start > Run) – Markus Jan 27 '15 at 8:11

I commented, but since somebody else agrees I'll post it as an answer instead:

java -jar /path/to/jar/jarFile.jar

Take care to note what mbx said too:

In case you have more than one JRE try giving the explicit path (C:\Programs..., "C:\Programs (x86)...")

share|improve this answer

Some jar files have information in them allowing to be executed with the -jar switch. If that information is not present you must use the -cp myjar.jar my.main.method.class argument to java.exe to execute your program.

Basically, if you install Java (the easiest is through http://java.com) then you can use that to run Java programs. It takes care of the correct version.

But it is not a problem to run a 32-bit JVM on a 64-bit system - the primary limitation is that your application is limited to a few gigabytes of memory.

So, if you can run java -version you will be fine with just using the default java command available to you.

share|improve this answer

Some Jar's I've had to lunch using the java.exe that is in the SysWOW64 folder.

c:\Windows\SysWOW64\java.exe -jar /path/to/jar/file.jar
share|improve this answer

You must log in to answer this question.

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