Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java 11 Cookbook

You're reading from   Java 11 Cookbook A definitive guide to learning the key concepts of modern application development

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher
ISBN-13 9781789132359
Length 802 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Mohamed Sanaulla Mohamed Sanaulla
Author Profile Icon Mohamed Sanaulla
Mohamed Sanaulla
Nick Samoylov Nick Samoylov
Author Profile Icon Nick Samoylov
Nick Samoylov
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Installation and a Sneak Peek into Java 11 FREE CHAPTER 2. Fast Track to OOP - Classes and Interfaces 3. Modular Programming 4. Going Functional 5. Streams and Pipelines 6. Database Programming 7. Concurrent and Multithreaded Programming 8. Better Management of the OS Process 9. RESTful Web Services Using Spring Boot 10. Networking 11. Memory Management and Debugging 12. The Read-Evaluate-Print Loop (REPL) Using JShell 13. Working with New Date and Time APIs 14. Testing 15. The New Way of Coding with Java 10 and Java 11 16. GUI Programming Using JavaFX 17. Other Books You May Enjoy

Installing JDK 18.9 on Linux (Ubuntu, x64) and configuring the PATH variable

In this recipe, we will look at installing JDK on Linux (Ubuntu, x64), and how to configure the PATH variable to make the JDK tools (such as javac, java, and jar) available from any location within the Terminal.

How to do it...

  1. Follow steps 1 and 2 of the Installing JDK 18.9 on Windows and setting up the PATH variable recipe to reach the downloads page.
  2. Copy the download link (tar.gz) for the JDK for the Linux x64 platform from the downloads page.
  3. Download the JDK by using $> wget <copied link>, for example, $> wget https://download.java.net/java/early_access/jdk11/26/BCL/jdk-11-ea+26_linux-x64_bin.tar.gz.
  1. Once the download completes, you should have the relevant JDK available, for example, jdk-11-ea+26_linux-x64_bin.tar.gz. You can list the contents by using $> tar -tf jdk-11-ea+26_linux-x64_bin.tar.gz. You can even pipe it to more to paginate the output: $> tar -tf jdk-11-ea+26_linux-x64_bin.tar.gz | more.
  2. Extract the contents of the tar.gz file under /usr/lib by using $> tar -xvzf jdk-11-ea+26_linux-x64_bin.tar.gz -C /usr/lib. This will extract the contents into a directory, /usr/lib/jdk-11. You can then list the contents of JDK 11 by using $> ls /usr/lib/jdk-11.
  1. Update the JAVA_HOME and PATH variables by editing the .bash_aliases file in your Linux home directory:
      $> vim ~/.bash_aliases
      export JAVA_HOME=/usr/lib/jdk-11
      export PATH=$PATH:$JAVA_HOME/bin

Source the .bashrc file to apply the new aliases:

      $> source ~/.bashrc
      $> echo $JAVA_HOME
      /usr/lib/jdk-11
      $>javac -version
      javac 11-ea
      $> java -version
      java version "11-ea" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+22)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+22, mixed
mode)
All the examples in this book are run against JDK installed on Linux (Ubuntu, x64), except for places where we have specifically mentioned that these are run on Windows. We have tried to provide run scripts for both platforms.
You have been reading a chapter from
Java 11 Cookbook - Second Edition
Published in: Sep 2018
Publisher:
ISBN-13: 9781789132359
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 $19.99/month. Cancel anytime
Banner background image