Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have a simple .jar file, when i run this:

>java -jar SLA.jar

It works correctly, however when i run


Nothing happens at all, i thought that these were meant to be the same the same.

What is going on here, is it something to do with my file associations? how can i set the default program for a .jar to be java -jar and not just java.

share|improve this question

migrated from Jan 14 '10 at 14:47

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

This isn't programming related. – kgiannakakis Jan 14 '10 at 14:22
it should go to superuser, where people will tell you that it depends on your OS and how to do it ;) – Bozho Jan 14 '10 at 14:24
++ on @Bozho; this is a Superuser question. – Tony Miller Jan 14 '10 at 14:28
up vote 2 down vote accepted

Tools | Options | File Associations | Look for JAR | Advanced Options | Edit the "open" action and use:

"C:\Archivos de programa\Java\jre6\bin\javaw.exe" -jar "%1" %*


"C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*

by example, it depends on your JRE location

share|improve this answer
I had to change it from javaw to java.exe and then this worked, not sure why i had to change it though, as it should work as you suggested, oh well, i don't mind :) – Paul Creasey Jan 14 '10 at 16:26
Only a guess: I lookup up the reference of javaw and it says: "The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason." If your program is a console one, when you do ">java ..." it has the current console. When you do ">file.jar" Windows (I guess) doesn't provide one. Then you must use java.exe to ensure there is one. – helios Jan 14 '10 at 18:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.