2

How do I create a Ubuntu terminal script that will open a .jar file?

This is what I have tried until now:

java -jar "/home/my-name/Desktop/Slow but Accurate/BulkNameChecker-slowbutaccurate.jar"

But it returns

Error: Unable to access jarfile /home/my-name/Desktop/Slow but Accurate/BulkNameChecker-slowbutaccurate.jar

1
  • try this if Java installed :java -jar Desktop/"Slow but Accurate"/BulkNameChecker-slowbutaccurate.jar or use cd command until you reach the Slow but Accurate folder and write java -jar BulkNameChecker-slowbutaccurate.jar Apr 2, 2012 at 17:48

1 Answer 1

2
  1. your java started correctly (error message is from java)
  2. java does not see that jar file.

I bet that if you do:

ls "/home/my-name/Desktop/Slow but Accurate/BulkNameChecker-slowbutaccurate.jar"

you will get:

ls: /home/my-name/Desktop/Slow but Accurate/BulkNameChecker-slowbutaccurate.jar: No such file or directory

so you can try:

ls "/home/"
ls "/home/my-name/"
ls "/home/my-name/Desktop/"
ls "/home/my-name/Desktop/Slow but Accurate/"
ls "/home/my-name/Desktop/Slow but Accurate/*.jar"
ls "/home/my-name/Desktop/Slow but Accurate/BulkNameChecker-slowbutaccurate.jar"

or:

find "/home/my-name" -name "*.jar"

to determine correct path.

Note1: you can use tab to assist you while typing a file names in terminal It is very handy.

Note2: If you use encrypted file system, or mounted when logged in and trying to run this script as another user, then the jar file might not be accessible, but most probable reason is a typo in the filename.

You must log in to answer this question.

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