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

so I was trying to run my java app on a 64 bit Windows 7. I installed manually a 64 bit JRE and then I typed "java", "javaw" and "java -version" on the CMD prompt and it didn't recognize neither the "java" nor "javaw" command. Same thing with a 32 bit JRE.

I set manually the path where java was installed in environment variables and that seemed to do the trick. But why isn't that done automatically by the JRE installer? Or is there any easier way of doing that? I don't want to tell how to fix this to every person how uses my program... Thanks!

share|improve this question

Installing java does install a windows shell extension. However java is designed to allow multiple versions running concurrent to each other and overwriting a global variable like PATH is just asking for trouble (especially if you install the older run-time after a newer run-time).

Your options are (In order of what I would do):

  1. Make your program work with launching it by double clicking on it from the shell.
  2. Compile a exe that launches the Jar (this is what Minecraft does)
  3. Create a shortcut that explicitly specifies java or javaw and pass your arguments.
  4. Include a launcher script that sets the all of the environment variables for the console you are running it inside but don't make them permanent.
  5. Create a installer that Modifies PATH.

Most people just go for option 1, but if you have to pass arguments you may have to do 3 or 4. I would suggest that you stay away from 5 as I like to write code that does not make global changes to the system.

share|improve this answer

You must log in to answer this question.

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