How do I open .jar files without using terminal in manually installed java? . I tried open with dialog but java is not there .so How do I manually create it?
Edit
I want some thing like this
Install Ubuntu Tweak.
Go to the 'admins' section, open the File Type Manager, Select 'All' file types, find and select Java Archives in the long list, choose edit, choose the Add button, click on the 'custom command' twisty at the bottom and type the custom command you need it to use to open the file the way you desire.
Here's a picture I did for another question
What are you trying to do? To open JAR as archive or to launch the application packed in JAR? Personally, I used to have a problem because Dolphin (KDE's default file manager) launched archiver on every JAR file, and the archiver opened JAR as a usual ZIP.
You can use a script like this and set it as default application for all .jar files. It will select what to do — to open archive or to launch Java application — depending on file's extension:
#!/bin/sh
basename=`basename "$1"`
extension=`echo "$basename" | awk -F . '{print $NF}'`
if [ "$extension" = "jar" ]
then
java -jar "$1" # open JAR files with Java
else
ark "$1" # open ZIP archives with your archiver (mine is Ark)
First you need to create a .desktop file referencing your manually installed java. So, create a .desktop file at ~/.local/share/applications
(for example: myjava.desktop) with the following content:
[Desktop Entry]
Name=My Java environment
Comment=OpenJDK
Exec=cautious-launcher %f /path/to/java -jar
Terminal=false
Type=Application
Icon=openjdk-6
MimeType=application/x-java-archive;application/java-archive;application/x-jar;
NoDisplay=true
cautious-launcher
is just a program that warns the user if the file it is trying to execute has not execution permissions.
You should also replace the name and path for your manually installed java.
After this you should have a new entry in the options "Other applications" separator (in this screenshot it already appears in "Recommended applications" because i already used it to open a .jar):
If the entry does not appear try executing update-desktop-database
in a terminal.
right-click on it, go to "permissions" tab and check "allow executing file as program"