Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.
java -jar yuicompressor-2.4.2.jar

~/src/yuicompressor-2.4.2/build$ ls

Usually, I have to be in that directory to run this command. Is there any way I can set it so that I can run this command anywhere in my box?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

try this:

cd ~/src/yuicompressor-2.4.2/
JAVA=`which java`
echo "$JAVA -jar $JAR" > yuicompressor.sh
chmod +x yuicompressor.sh
sudo ln -s yuicompressor.sh /bin/yuicompressor.sh

now you (and other users) should be able to run yuicompressor.sh from anywhere

share|improve this answer

you could make an alias:

alias yuicomp=java -jar yuicompressor-2.4.2.jar

you would need to put the full path in asw ell I think

share|improve this answer

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.