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 want to use Yahoo's compressor for compressing js and css files.

Which can be found here:

My only problem is that i have never used Java before. I have no idea how to execute or use this command line. I only have experience with js, jquery and php.

It simply says:


java -jar yuicompressor-x.y.z.jar [options] [input file]

How should I proceed?

share|improve this question

migrated from Mar 11 '11 at 14:06

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

Have you even attempted executing that command on your command line? – Joachim Sauer Mar 11 '11 at 7:41
Voting for migration because this question boils down to: How do I start a Java application. – Bobby Mar 11 '11 at 7:47

Grab yourself a copy of the Java Runtime Enviroment (JRE):

Install this, and use the java.exe that's being installed to run the program from the commandline (Windows->Run->cmd.exe [enter]) and add the parameters as described in your question.

C:\> java.exe -jar yuicompressor-x.y.z.jar [options] [input file]
share|improve this answer

Install the Java Runtime or Java JDK from

If on Windows you might have to modify the environment variables and add java.exe to your path.

After that, download the yuicompressor and place the file you want to compress in the same directory.

To compress a file A.js and save the compressed file as A.compressed.js (or css if you like)

C:\>java -jar yuicompressor-x.jar -o A.js A.compressed.js

If the -o option is not provided the output will be the standard output (probably your console).

To get help run

C:\>java -jar yuicompressor-x.jar --help (or execute with no options)
share|improve this answer

You must log in to answer this question.