分类: LINUX
2014-05-16 09:06:02
In the past, Sun JDK was the default java package in Ubuntu. After Sun Microsystem was acquired by Oracle in 2010, Ubuntu (and various distros) switched the java package to the fully open-source OpenJDK as the SUN JDK no longer contain codes that are fully open-sourced.
OpenJDK is community-built and is (almost) 100% similar to the SUN JDK. You can easily install OpenJDK in Ubuntu via the Ubuntu Software Center, by clicking or running the command:
点击(此处)折叠或打开
This method requires you to install SUN JDK 7 manually. It is a good way for you to learn the trick.
1. Download the SUN JDK 7 to your home folder.
2. Extract the tar file.
3. Move the extracted file to the “/usr/lib/jvm/” folder:
点击(此处)折叠或打开
点击(此处)折叠或打开
点击(此处)折叠或打开
Enter the option that corresponds to the SUN JDK package. Press Enter.
That’s it.
To test your java:
点击(此处)折叠或打开
If you don’t want to manually install the SUN JDK, you can do it via a PPA. Since there is no official PPA for SUN JDK, you will have to grab a custom PPA that comes with the java package. Note that custom PPAs might add extra software sources to the repository, and cause your system to be bloated or even have conflicts with other apps. So bear in mind the risk involved.
There are several PPAs out there that come with SUN JDK, one that you can use is “webupd8team/java”
点击(此处)折叠或打开
Even
after you have installed the java package, you will find that the java
applet in your browser won’t run. If you are using the OpenJDK, here is
another package that you need to install:
点击(此处)折叠或打开
点击(此处)折叠或打开
Once install, restart your browser. The java applet should run now. To test if Java is working in your browser, go to . If installed correctly, you should see a “Your java is working” message.