Oracle Java JDK: Difference between revisions

Created page with "Oracle announced Java 18 a few days ago. Here’s how to install the programming language in Ubuntu Linux. ===What’s New in Java 18=== *New Oracle Cloud Infrastructure (OCI) native service to help manage Java runtimes and applications on-premises or on any cloud. *Sets UTF-8 as the default charset of the standard Java APIs *A command-line tool and API to start a minimal web server that serves static files only. *Reimplement core reflection with method handles *Intern..."
 
No edit summary
Tags: Mobile edit Mobile web edit
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:


===What’s New in Java 18===
===What’s New in Java 18===
*New Oracle Cloud Infrastructure (OCI) native service to help manage Java runtimes and applications on-premises or on any cloud.
*New Oracle Cloud Infrastructure (OCI) native service to help manage Java runtimes and applications on-premises or on any cloud.
*Sets UTF-8 as the default charset of the standard Java APIs
*Sets UTF-8 as the default charset of the standard Java APIs
Line 12: Line 11:
*Foreign Function and Memory API (Second Incubator)
*Foreign Function and Memory API (Second Incubator)
*Pattern Matching for Switch (Second Preview)
*Pattern Matching for Switch (Second Preview)
==Install JDK 18 in Ubuntu==
==Install JDK 18 in Ubuntu==
This Ubuntu PPA maintains installer script for automatically installing Java. It however does not update for the new Java 18 release.
This Ubuntu PPA maintains installer script for automatically installing Java. It however does not update for the new Java 18 release.
Line 30: Line 27:
It installs the language files into <code>/usr/lib/jvm/jdk-18/</code> directory. To set it as default, do the following 2 steps one by one.
It installs the language files into <code>/usr/lib/jvm/jdk-18/</code> directory. To set it as default, do the following 2 steps one by one.


'''a.''' Create symbolic links for the executable files:
'''a.''' Create symbolic links for the executable files:<syntaxhighlight lang="shell">
 
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-18/bin/java 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-18/bin/java 1


  sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-18/bin/javac 1
  sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-18/bin/javac 1
Line 48: Line 44:
  sudo update-alternatives --config jar
  sudo update-alternatives --config jar


When done, verify by running command in terminal:
When done, verify by running command in terminal:<syntaxhighlight lang="shell">
 
java -version
java -version


  javac -version
  javac -version
Line 59: Line 54:


  export JAVA_HOME=/usr/lib/jvm/jdk-18
  export JAVA_HOME=/usr/lib/jvm/jdk-18
  setenv JAVA_HOME=/usr/lib/jvm/jdk-18
  setenv JAVA_HOME=/usr/lib/jvm/jdk-18


Line 82: Line 76:
  setenv J2SDKDIR /usr/lib/jvm/jdk-18
  setenv J2SDKDIR /usr/lib/jvm/jdk-18
  setenv J2REDIR /usr/lib/jvm/jdk-18
  setenv J2REDIR /usr/lib/jvm/jdk-18
  setenv PATH ${PATH}:/usr/lib/jvm/jdk-18/bin:/usr/lib/jvm/jdk-18/db/bin
  setenv PATH ${PATH}:/usr/lib/jvm/jdk-18/bin:/usr/lib/jvm/jdk-18/db/bin  
  setenv JAVA_HOME /usr/lib/jvm/jdk-18
  setenv JAVA_HOME /usr/lib/jvm/jdk-18
  setenv DERBY_HOME /usr/lib/jvm/jdk-18/db
  setenv DERBY_HOME /usr/lib/jvm/jdk-18/db