A quick search turned up a blog post at Web Upd8 which explains why the official repositories lag behind:
Oracle JDK7 itself is not hosted in the PPA because that's not allowed by the new Java license (which is also the reason why it has been removed from the official Ubuntu repositories); the package in the PPA automatically downloads (and installs) Oracle Java JDK 7 from its official website and installs it on your computer, just like the flashplugin-installer package does.The PPA (personal package archive) repository to which they refer contains a package that automatically downloads and installs the current version of the Oracle Java 7 JDK. (Note that there is no comparable package to install just the JRE; you have to install the full JDK, which contains the JRE as a subset. That's fine with me, since I need the JDK for program development.)
The instructions are straightforward and worked fine for me. Once I had confirmed that Java 7 was installed and was the default choice, there was one more step. I use the Netbeans IDE for writing Java code. I could have installed the latest version with Java 7 bundled, but that's a hefty download, and my current version of Netbeans is recent enough. In Netbeans, I clicked Help > About and discovered that Netbeans was still launching with Java 6. The solution is to edit the configuration file <netbeans>/etc/netbeans.conf (where <netbeans> is the top directory of the Netbeans installation) and change the setting for netbeans_jdkhome to point to the Java 7 directory. When I restarted Netbeans, it launched with Java 7 and also changed the default Java platform for compiled code to Java 7.
Big thanks to the PPA maintainers for simplifying the process.
Oracle has discontinued the "Operating System Distributor License for Java" (DLJ) [http://jdk-distros.java.net/] plan in 2011; Ubuntu users now get their daily dose of coffee via
ReplyDeletesudo apt-get install openjdk-7-jdk
and/or
sudo apt-get install openjdk-7-jre
plus
sudo apt-get install icedtea-plugin
[cf.
https://help.ubuntu.com/community/Java
http://openjdk.java.net/install/]
Yes, you should use OpenJDK instead of Oracle's implementation. Wikipedia says: "As of Java SE 7, OpenJDK is the official Java reference implementation."
DeleteI think since Java 7, Oracle's implementation and OpenJDK are mainly the same.
Best regards,
Thomas
Florian and Thomas: The key here is "mainly the same". I have a couple or so programs I wrote that I share with other people (open source). They have GUIs written using Swing, and they need to run cleanly on multiple platforms (Linux, Mac and Windows). For very small values of $\epsilon$, $(100-\epsilon)\%$ of Windows users that have Java have the Sun/Oracle version. Can I safely assume that OpenJDK's version of Swing is fully compatible with Oracle's? If so, and assuming no key language features are missing, I'd be happy to switch to OpenJDK.
DeleteContinuing previous comment: I just found this page which seems to indicate that there are problems using Swing with OpenJDK apps on OSX. I think I'll stay with the Oracle version for now, but hopefully the kinks in Swing on OpenJDK will be ironed out soon.
DeleteFirst of all, since OpenJDK 7 is the _official_ Java SE 7 reference implementation [https://blogs.oracle.com/henrik/entry/moving_to_openjdk_as_the], its behaviour is by definition the default behaviour.
DeleteFurthermore, Oracle's JDK7 basically is nothing more than an OpenJDK release [http://www.infoq.com/news/2009/01/jdk-openjdk-icedtea] w/ web browser plugin and Web Start technology [http://en.wikipedia.org/wiki/OpenJDK#Components] - here, IcedTea comes into play ...which is certified "Java compatible".
(Reported compatibility issues mainly refer to v6 - since they had different code bases.)
In fact, there's a big advantage of using OpenJDK over Oracle's JDK: you can distribute OpenJDK with your implementation - which you can't do with Oracle's JDK (and there are 33 releases of v6 and 5 of v7).
+1 on fbahr's comment.
ReplyDeleteOpenJDK 7 + Web Start + browser plugin == Oracle JDK 7
However, this was not the case for Java 6:
OpenJDK 6 + Web Start + browser plugin != Sun (= Oracle) JDK 6
because the Sun JDK 6 contained a bunch of proprietary third-party code, most notoriously for fonts (which are important for Swing to run correctly).
I bow to the consensus. :-) Unfortunately, I'm running Mint Katya, forked from Ubuntu Natty, and OpenJDK 7 does not seem to be available for Natty. (As best I can tell, packages start with Oneiric.) One of these days I'll upgrade to a more recent Mint release, at which time I should be able to install OpenJDK 7. For now, I'll muddle along with the Oracle version.
DeleteThanks all for the comments. The clarification was quite helpful.
Oh, yes, you're right ...looks like OpenJDK7 is only available for "Oneiric Ocelot" (11.10) and newer:
Deletehttp://packages.ubuntu.com/en/oneiric/openjdk-7-jdk
http://packages.ubuntu.com/en/oneiric/openjdk-7-jre
http://packages.ubuntu.com/en/oneiric/icedtea-plugin