Tuesday, April 23, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 12296  / 2 Years ago, sat, january 29, 2022, 5:39:01

I could do it with OpenJDK, but it didn't work for my purposes so I'm using Oracle's JRE 7. I can run the jar through the terminal with



java -jar filename.jar



and can also right click the file and click Open With > Oracle Java 7 Runtime, but I can't set the Java 7 Runtime by default in the Properties menu (probably because the runtime executable isn't located in /usr/bin).



Any quick command lines I can type to set it so I can just hit enter on the file and launch the .jar with Java 7?


More From » java

 Answers
5

I've had a similar question, and I found the answer, it was a missing .desktop file for me, and I included a guide to manually creating one (although I'm hoping that somebody will show me a better way) anyway, here is how I did it.



1) Open Gedit from the Terminal with root privileges usind gksu gedit



2) Open a .desktop file from /usr/share/applications and copy it into a new file.



3) Edit the name, comments, and image to your liking.



4) Change the command to java -jar %u DO NOT FORGET THE %u



5) Save



6) Right click .jar file in nautilus, select properties>open with>show all applications, and select the new entry, select either add or set as default.


[#36692] Sunday, January 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nguai

Total Points: 216
Total Questions: 108
Total Answers: 116

Location: Hong Kong
Member since Thu, Dec 16, 2021
2 Years ago
;