1

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:

selenium

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?

Thanks

1 Answer 1

2

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .