Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I execute .jar java program on Windows 7 command line?

I have been looking things up online and could not find a good answer so far. I want to execute the YUI compressor tool to obfuscate/minify my javascript file. I do have JRE installed.

It looks like the file association is fine as you can see here:

C:\directory\tempFiles>assoc .jar
    .jar=jarfile

I set up file association using ftype:

C:\directory\tempFiles>ftype jarfile
     jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*

The compressor tool is saved as a .jar file and is called "yuicompressor-2.4.6.jar"

When I try to run the .jar file, the cmd kept saying that the word 'java' is not recognized as an internal command... this is how I run it:

C:\directory\tempFiles\yuicompressor-2.4.6\build>java -jar yuicompressor-2.4.6.jar [options] [input file]

Any help would be appreciated thanks

like image 780
Benny Tjia Avatar asked May 21 '11 23:05

Benny Tjia


1 Answers

Add the JDK / JRE bin folder path to your PATH. See here.

like image 52
MByD Avatar answered Sep 21 '22 18:09

MByD