Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to use Yahoo's compressor for compressing js and css files.

Which can be found here:

http://developer.yahoo.com/yui/compressor/

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:

Usage:

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

How should I proceed?

share|improve this question

migrated from stackoverflow.com Mar 11 '11 at 14:06

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

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

2 Answers 2

Install the Java Runtime or Java JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html

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
add comment

Grab yourself a copy of the Java Runtime Enviroment (JRE): http://www.oracle.com/technetwork/java/javase/downloads/index.html

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
add comment

Your Answer

 
discard

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