Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
OpenJDK Cookbook

You're reading from   OpenJDK Cookbook Over 80 recipes to build and extend your very own version of Java platform using OpenJDK project

Arrow left icon
Product type Paperback
Published in Jan 2015
Last Updated in Feb 2025
Publisher
ISBN-13 9781849698405
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
 Kobylyanskiy Kobylyanskiy
Author Profile Icon Kobylyanskiy
Kobylyanskiy
 Mironchenko Mironchenko
Author Profile Icon Mironchenko
Mironchenko
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Getting Started with OpenJDK FREE CHAPTER 2. Building OpenJDK 6 3. Building OpenJDK 7 4. Building OpenJDK 8 5. Building IcedTea 6. Building IcedTea with Other VM Implementations 7. Working with WebStart and the Browser Plugin 8. Hacking OpenJDK 9. Testing OpenJDK 10. Contributing to OpenJDK 11. Troubleshooting 12. Working with Future Technologies 13. Build Automation Index

Distinguishing OpenJDK from Oracle JDK

Though OpenJDK is an official reference implementation for the Java platform, certain Oracle-provided software are not open source. The most famous of them is the Java browser plugin, but there are a lot more differences than just that. This recipe will show you how to distinguish OpenJDK from Oracle JDK.

Getting ready

To follow this recipe, you will need an installed OpenJDK instance. It will be good if you have an Oracle JDK instance as well, to feel the difference. Also, we will assume that you have a Linux installation and an update-java-alternatives command installed and ready to use. To know how to install OpenJDK on various systems, see the later recipes in this chapter. To know how to switch the system Java version, if you do not have update-alternatives installed (for Fedora, Gentoo, and so on), visit the Configuring OpenJDK on Linux recipe or refer to your distribution documentation/forums.

How to do it...

Please take a look at the following procedures to know the difference between OpenJDK and Oracle JDK:

  1. We will open a terminal and type the following command:
    update-java-alternatives  --list
    
  2. We will see a full list of installed Java implementations:
    $ update-java-alternatives  --list
    java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
    java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
    java-6-oracle 1073 /usr/lib/jvm/java-6-oracle
    java-7-oracle 1081 /usr/lib/jvm/java-7-oracle
    java-8-oracle 1082 /usr/lib/jvm/java-8-oracle
    
  3. Let's set Oracle Java as default. We will run the following command with root access:
    update-java-alternatives  --set java-7-oracle
    

    Tip

    This command may produce errors such as "no alternatives for apt". It's OK, just ignore them.

  4. Then we will go to https://www.java.com/en/download/installed.jsp?detect=jre and check our browser plugin version. We will see the activate link (following the name of the activating entity).

    We can see from the result of our actions that the Java browser plugin has been installed.

  5. Let's try to set OpenJDK as the default Java environment (the actual instance name may differ in your case):
    update-java-alternatives  --set java-1.7.0-openjdk-amd64
    
  6. Then we will go to our browser page and refresh it. It may be necessary to restart the browser so that the changes can take effect, as shown in the following screenshot:
    How to do it...

We can see that the plugin is not from the JDK itself but from a project named IcedTea.

IcedTea is an open source project, whose goal is to replace proprietary parts of the Java ecosystem as much as possible. The plugin itself is from IcedTea-Web, an open source implementation of the Java Web Start and Java browser plugins.

In most distributions, the IcedTea plugin is installed by default. But it is necessary to keep in mind that it's an open source plugin, and definitely not a referenced one. This means that its functionality might be slightly different from the Oracle plugin. It is also possible that some features may not work.

How it works…

Oracle JDK still has some proprietary components, and the browser plugin is one example. All we need in this chapter is to see the difference between the work of OpenJDK and Oracle JDK components that are different.

Also, the huge difference between OpenJDK and Oracle JDK lies in the license. OpenJDK is open source, while Oracle JDK contains proprietary pieces, and thus it is licensed under the Oracle binary license. The fact that OpenJDK is open source provides a whole new range of benefits (and exciting discoveries) through the ability to study and modify its source code. It is also worth mentioning that more than 90 percent of Oracle JDK is based on OpenJDK source code. This means the OpenJDK quality is not compromised in any way. The browser plugin is not the only thing that is missed in OpenJDK compared to Oracle JDK.

See also

  • In Chapter 5, Building IcedTea, there is a detailed explanation of how to build IcedTea from source.
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
OpenJDK Cookbook
You have been reading a chapter from
OpenJDK Cookbook
Published in: Jan 2015
Publisher:
ISBN-13: 9781849698405
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon