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

Installing OpenJDK on Linux

The Linux operating system allows for many internal tweaks, as well as for changes to the system's source code. It is also known as a complicated OS, and not all distributions are user-friendly. There are many people using it, and it's open source, such as OpenJDK itself. The installation process varies between chosen distributions, and we will go through the process for the three most-used package managers, as well as through the process that will work for virtually all x86 Linux distributions.

Getting ready

To follow this recipe, you will need an installed Linux system. It will be better if it has the kernel version 2.6 or higher, though OpenJDK is reported workable on 2.4 kernels as well. Also, if you have the .deb, .rpm, or .ebuild package manager, the recommended way to install any package is to install it using those.

How to do it...

When the installation of various packages is concerned, the process is dependent on our Linux distribution.

For a Debian-based distribution:

  1. Open a terminal and type:
    apt-get install openjdk-7-jdk

    Tip

    We should have root permissions or use sudo to gain access to system files.

  2. This will trigger the installation automatically. If we get an error message, indicating that the package is not found, we should Google an appropriate name for an OpenJDK package for our distribution.

For an RPM-based distribution, we'll need to first search for the package names, because package names are varied between different distributions, as shown here:

yum search openjdk

You will see an output like this:

java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle

You may install all of the packages that have the desired version. Then, we will run another command, using the package name we've just found:

yum install <a found package name>

This will also trigger an automatic download and installation.

If we have a Gentoo-based distribution, just type the following:

emerge openjdk-1.7

This will, depending on your distribution, unpack and install a binary package or, more probably, automatically build this package from source.

There's more...

Aside from the recommended ways, there is a generic installation procedure. It is quite simple, though it may do some damage to your operating system, so don't use it unless you really know what you're doing:

  1. This is the way to unpack the OpenJDK system and then install it yourself. To get the builds, we will refer again to the unofficial build page, https://github.com/alexkasko/openjdk-unofficial-builds.
  2. Then unpack the downloaded package into a folder and run the following command from it:
    java -jar ./install.jar
  3. A GUI installer window will appear. Read and accept the license, choose the directory, and allow OpenJDK to be created, if it does not exist, as shown:
    There's more...
  4. Check the preceding checkbox if you want to make this installation the default one. Then click on the Next button.
  5. Wait for the installation to complete, and click on Next for the last time.
  6. Then click on Done.
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