Tuesday, January 8, 2013

Getting Java working in Linux Mint 14 XFCE and Cinnamon for ProxMox and other apps


Linux Mint 14 XFCE and Cinnamon
The following are the Steps which I took to install Oracle Java 7, which I needed for ProxMox functionality, then reverting back to openJDK so other apps I have (don't work on Oracle Java 7) still work.

What I Actually Did
  • Followed the advice here: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
    • sudo add-apt-repository ppa:webupd8team/java
    • sudo apt-get update
    • sudo apt-get install oracle-java7-installer
  • This installed Java 7, but not all my java stuff works with Java 7 yet, so for now I switch back to the default Openjdk.  This leaves the new functionality of java 7 needed for ProxMox intact, namely the embedded vncviewer functions.  So after we are left with a mixed setup,  but it works for now, and I can switch back and forth between java versions using the command given below.
    • switch back to the openjdk java
      • java -version
        • this verifies the oracle java 7 is installed (if not link to tutorial)
      • update-java-alternatives -l
        • this lists the installed alternatives
        • note the openjdk java listed
      • sudo update-java-alternatives -s [name of openjdk]
        • this switches back to primary java use of openjdk, but keeps links to Oracle Java 7 intact for functions not supported in openjdk
        • will show some errors because of the missing alternatives in openjdk
      • java -version
        • this should show the openjdk java
  • Various command options:
    • Check the java version installed
      • java -version
    • help on the update-java-alternatives
      • man update-java-alternatives
    • Remove the Oracle Java 7
      • sudo apt-get remove oracle-java7-installer


How this is setup on Linux Mint 14 XFCE and Cinnamon
  • update-java-alternatives: this is the program setup for 
  • jinfo files: java info files are used to inform the update-java-alternatives program, which is the program that is used to change java alternatives
    • hidden file located in /usr/lib/jvm/ ... example /usr/lib/jvm/.java-1.7.0-openjdk-amd64.jinfo
    • contains information on where to access java sub-programs and plugins
  • Sim links from /usr/bin/[file] to /etc/alternatives/[file] for the following
    • java --> java
    • javaws --> javaws
    • jexec --> jexec
    • missing is a jar link that some help sites reference
  • Sim link from /etc/alternatives/[file] to /usr/lib/jvm/[dir/file] for the following (thus a link of a link is formed)
    • java --> java-7-openjdk-amd64/jre/bin/java
    • javaws --> java-7-openjdk-amd64/jre/bin/javaws
    • jexec --> java-7-openjdk-amd64/jre/lib/jexec
    • keytool --> java-7-openjdk-amd64/jre/bin/keytool
    • itweb-settings --> java-7-openjdk-amd64/jre/bin/itweb-settings
    • Plus the sim links for .1.gz files from and to same directories as above for the following
      • java.1.gz  --> java-7-openjdk-amd64/jre/man/man1/java.1.gz
      • javaws.1.gz --> java-7-openjdk-amd64/jre/man/man1/javaws.1.gz
      • jexec-binfmt --> java-7-openjdk-amd64/jre/lib/jar.binfmt
      • keytool.1.gz --> java-7-openjdk-amd64/jre/man/man1/keytool.1.gz
      • itweb-settings.1.gz --> java-7-openjdk-amd64/jre/bin/itweb-settings.1.gz

Links to other help resources:

I had started out on this path, but abandoned it when seeing the easier install method I used above:
  • Download the latest Java from Oracle's Java.com website
  • Open a terminal and do the following
  • Move this file into the right directory for Linux Mint
    • sudo mv ~/Downloads/jre-7* /usr/lib/jvm
  • Unpack in place, then delete the original file.  You will now have a directory in place with the new java runtime file in it. /usr/lib/jvm/jre1.7.0_10
    • cd /usr/lib/jvm
    • sudo tar zxvf jre-7u10-linux-x64.tar.gz
    • sudo rm jre -7u*
  • Create links to new java programs
    (this will be a LOT of work)

No comments:

Post a Comment