Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 5378  / 3 Years ago, thu, may 6, 2021, 7:18:14

I just installed java according to this article, and java -version displays


java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

update-alternatives --config java' returns this:


There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gij-4.6 1046 auto mode
1 /usr/bin/gij-4.6 1046 manual mode
* 2 /usr/local/java/jdk1.7.0_07/bin/java 1 manual mode

Press enter to keep the current choice[*], or type selection number:

with update-alternatives --config javac (or javaws) returning similarly.


however Java isn't listed in the default applications menu when I click on a .jar file and go to "open with application".



  • I tried to install Java this way, and on the update-alternatives part of the command returned me:



    /etc/alternatives/[java,javac,javaws] is dangling, it will be updated with best choice




  • I just confirmed that I can use Java, as java -jar file.jar does work.



  • Just figured that I'd mention it, don't know why I didn't before, but when I right click on a .jar file, Java 7 run-time isn't even listed there, it seems that the file manager isn't recognizing it as a program, but it is there, and it does work...




CAUSE OF THE PROBLEM


After much experimenting, and research, I've found the cause of the problem - a missing .desktop file in /usr/share/applications. I've posted an answer that you can use to manually create an entry, but as stated it isn't recomended as I'm sure that there's a better way to do it.


More From » java

 Answers
4

I've patched together a way to do it, but it's not the recommended way of creating a .desktop entry (there's has to be a better way of doing 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.


[#35814] Thursday, May 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
imonove

Total Points: 82
Total Questions: 113
Total Answers: 106

Location: Saint Vincent and the Grenadines
Member since Wed, Nov 3, 2021
3 Years ago
;