Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

My question is this.

I have a jar file that I want to be able to run from command line with a simple command. So in my ~/.bashrc file I created an alias like so:

alias selenium='java -jar selenium-server-standalone-2.31.0.jar'

the jar file is in here: /usr/local/bin

and I have /usr/local/bin in my path variable. My understanding is that because it is in my Path variable I can run it from anywhere, however if I open a terminal and type:


I get this:

Error: Unable to access jarfile selenium-server-standalone-2.31.0.jar

so the alias is working, but it cant access the file. If I change directory to /usr/local/bin and type selenium again it works

Any reason why I can't run this from anywhere?

Also, what is the purpose of /usr/local/bin folder. IS this where I should put programs I want to run?


share|improve this question
up vote 2 down vote accepted

You are not running the .jar file by itself. Instead you run java and pass the name of the jar file as a parameter. If you pass only the name of the file but not a full path the system will assume the file is in your current directory and if it is not you will get the error you mentioned. You should pass the full path after the -jar flag and then you can run your alias from any directory.

share|improve this answer
Good to know. Thanks for the feedback. – Kevin Bradshaw Mar 23 '13 at 15:13

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.