1

Oracle JDK doesn't appear

I had installed originally Oracle JDK 7 update 4, with update-alternatives installation instruction and the JDK became manual mode (3). OpenJDK 7 in auto mode (O).

When I will run/install .jar file Oracle Java Runtime doens't appear. How should I do to fix it?

thank you

1

If you want to bring Oracle JDK to that menu then you have to create a .desktop file for Oracle JDK under /usr/share/applications if it is not already there. What about clicking Show other application button to see available application? If the Oracle JDK is not there then follow these steps:

  1. sudo gedit to open gedit as super-user
  2. write
    [Desktop Entry]
    Name=Oracle JDK
    Exec=path to Oracle's java here -jar
    Terminal=false
    Type=Application
    Icon=openjdk-6
    MimeType=application/x-java-archive;application/java-archive;application/x-jar;
    NoDisplay=true
    then save the file as /usr/share/applications/OracleJDK.desktop
  3. sudo chmod +x /usr/share/applications/OracleJDK.desktop to make the .desktop file executable
  4. sudo gedit /usr/share/applications/bamf.index and add the line OracleJDK.desktop path to Oracle's java here -jar to the end and save.
  5. open the file /usr/share/applications/mimeinfo.cache as super-user(sudo gedit) and add change the line application/java-archive=openjdk-xxx.desktop; to application/java-archive=openjdk-xxx.desktop;OracleJDK.desktop; i.e. just add your newly created desktop entry to mime-cache.
  6. Now you should find Oracle JDK entry under the applications menu if you click view other applications
  • great thanks.. what does "-jar" mean for? and for the path.. applying /usr/lib/jvm/jdk1.7.0_04/jre/java, right? – obysr Jun 6 '12 at 23:38
  • [Desktop Entry] Name=Oracle JDK Exec=/usr/lib/jvm/jdk1.7.0_04/jre/bin/java -jar Terminal=false Type=Application Icon=openjdk-6 MimeType=application/x-java-archive;application/java-archive;application/x-jar; NoDisplay=true why doesn't it work? – obysr Jun 6 '12 at 23:51
  • -jar is the argument to java if you want to interpret/execute .jar files instead of a .class file. And for the .desktop file, make sure there is no space after the [Desktop Entry] line or it won't work. – Samik Jun 7 '12 at 8:46
  • I've edited the answer to add step 4 and 5. perform that too. – Samik Jun 7 '12 at 10:15
  • thanks... but it has not worked yet in step 3 i writed it into .desktop and put into usr/share/applications [Desktop Entry] Name=Oracle Java Runtime 7 Name[fi]=Oracle Java Runtime 7 Comment=Oracle Java Runtime 7 Comment[fi]=Oracle Java Runtime 7 Exec=/usr/lib/jvm/jdk1.7.0_04/jre/bin/java -jar Terminal=false Type=Application Icon=openjdk-7 MimeType=application/x-java-archive;application/java-archive;application/x-jar; NoDisplay=true – obysr Jun 8 '12 at 3:03
1

Samik's answer is great but remove the NoDisplay command which hides the app in Comice OS 4.

[Desktop Entry]
Name=Oracle JDK
Exec=path to Oracle's java here -jar
Terminal=false
Type=Application
Icon=openjdk-6
MimeType=application/x-java-archive;application/java-archive;application/x-jar;
NoDisplay=false
0

i have searched the information about this case. Actually Oracle JRE runs automatically when jar files or jar files included are executed. It doesn't support interaction like this.

if jar files can't be executed, you seems not to be installed correctly.

Sorry if I'm wrong. That's all i found. If there's someone who know more, please add answer.

0

The above answer is not sufficient enough

you also need to update mime list as

open file in editor

gedit ~/.local/share/applications/mimeapps.list

then replace this

application/x-java-archive=file-roller.desktop;

to

application/x-java-archive=OracleJDK.desktop;

This will resolve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.