Making Java A Default Application To Run .Jar's (Ubuntu 12.04)
Well this is really bothering me, I installed JDK1.7.0_07 but it wont allow me to set it as the default to open jar files. I can run the file but I have to select "Java Runtime Enviroment" every time. Is there any way I could add Java 7u7 to the list of applications to use with JAR files?
|
post output of java -version
|
What distro are you using?
|
open .jar with java runtime by default - help requested
Hi, I have the same problem. I have Linux Mint 14 64 bit, Cinnamon. When I right-click on the file and go to open with, from the drop down, I have in the list: Java Runtime, Java Web Start, and OpenJDK Java 7 Runtime. The ones that will run it are: Java Runtime and OpenJDK Java 7 Runtime. However, when I go to properties > open with > show other applications, neither of these are listed. How can I change this? Note that I installed Java from the instructions on this page [w**.duinsoft.nl/packages.php?t=en] (under repository) and java works great. output of java -version:
java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode) |
help?
Please help...
|
I don't know if this fixes all .jar files, but if you right click on the .jar of interest, select properties, select OpenJDK Java 7 Runtime (or whatever you want the default to be) and then click the "Set as Default button", that worked for me.
|
Quote:
It's possible that running Code:
xdg-mime default java application/java-archive |
Quote:
|
Quote:
I get: xdg-mime: malformed argument 'java', expected *.desktop Try 'xdg-mime --help' for more information. Linux Mint 14 64 bit, Cinnamon by the way. |
workaround
I have a workaround that gacanepa posted on another thread that I'm satisfied with.
http://www.linuxquestions.org/questi...9/#post4853860 create launcher on desktop and put command in: java -jar /home/---path---/file-to-run.jar Thanks though. |
Quote:
But glad you got it sorted. Can you mark the thread as SOLVED using the link at the top of the page, please. Regards, |
Quote:
Hi Snark1994, and thanks for your help. I don't consider it solved since I have a workaround (something that works even though it's not exactly what I was looking for). Now that you've brought up information about running the command xdg-mime, now I'm interested in making that work. I tried copying the desktop file into the directory that you mentioned and I got the same thing back in terminal as before, xdg-mime: malformed argument 'java', expected *.desktop |
Okay, you'll need to edit the file (so that it runs java, rather than whatever .desktop file you copied there). But like I said in my last post, the issue with the command is that you need to type:
Code:
xdg-mime default .local/share/applications/java.desktop application/java-archive Regards, |
I don't know how to proceed. I installed Java from the instructions on this page [www.duinsoft.nl/packages.php?t=en] (under repository) , so maybe my situation is not typical. I did not edit any .desktop file. I put the following into terminal:
xdg-mime default .local/share/applications/update-sun-jre-java.desktop application/java-archive and got no response. No error, no success message. From the /usr/share/applications folder, all related to java are: update-sun-jre-controlpanel.desktop update-sun-jre-java.desktop update-sun-jre-javaws.desktop update-sun-jre-policytool.desktop When I try to change the default program to launch a .jar file (right-click on .jar file, properties, open with), Java Runtime is not on the list (I would like it to be on the list). It is available via right-click on .jar file, open with. As noted in my post below: http://www.linuxquestions.org/questi...9/#post4853344 The following shows the contents of the update-sun-jre-java.desktop file in case you're wondering. [Desktop Entry] Encoding=UTF-8 Name=Java Runtime Comment=Java Runtime Exec=/opt/java/64/jre1.7.0_11/bin/java -jar Terminal=false Type=Application Icon=sun-java MimeType=application/x-java-archive;application/java-archive;application/x-jar; NoDisplay=true |
I wouldn't expect there to be a response, and the .desktop file looks fine. If you run "xdg-open foo.jar" it should hopefully open it with java and if you double click on a .jar file I would expect the same to happen. If not, then Ubuntu must use a different method (certainly programmes like Firefox respect the xdg defaults), so more research would be needed...
|
After putting the following into terminal,
xdg-mime default .local/share/applications/update-sun-jre-java.desktop application/java-archive Nothing has changed. But that's okay, it's not a big deal, if I don't find a way to change the default to open with Java Runtime, no problem. When I double-click the file or use xdg-open file-in-question.jar or right-click > open with java web start: java 7 in some form starts up and then reports "Unable to launch application". However when I right click on the .jar file, click open with > java runtime, then in opens fine. I don't want to mark it as solved, because my original question isn't solved. Is it important to close this thread? I thought that since I have a common distro and that my questions could help others, I would ask for help. Thanks again for your patience! |
Quote:
When you go Properties > Open With... is there an option to "Browse for more" or "Browse for executable" or something similar? It may only appear when you click on "Show Other Applications". If so, then just find java and select it. If not, then could we maybe have a screenshot? I feel there must be a way of doing what you want to do... |
3 Attachment(s)
There is an option "show other applications" but can't browse, it only gives a list of more programs, and Java Runtime isn't on the list. Java WebStart will not open the .jar file and reports "Unable to launch application". Whereas [right-click on file > open with Java Runtime] runs .jar file perfectly.
|
1 Attachment(s)
another screenshot. reached my maximum of 3 on last post.
|
Hm... And that "Add" button is greyed out no matter where/what you click? Perhaps we need to find someone who actually runs Mint, or maybe I can boot it in a VM...
|
The add button only becomes available after selecting another one in the list other than the current default. No option to browse for program.
|
This is not urgent or really important. Why don't we just wait and see if somebody that's running Mint sees this thread? If not, no big deal...
|
Quote:
|
Okay, we got the problem sorted at least in cpocanada's case: the problem was that the correct mimetype is "application/x-java-archive" (I mistakenly said "application/java-archive"). So the fix was to use the following line in .local/share/applications/mimeapps.list:
Quote:
Regards, |
All times are GMT -5. The time now is 05:11 PM. |