This section describes the APIs, features, and options that were removed in Java SE 9 and JDK 9. Other sources of information about the APIs, features, and options removed in Java SE 9 and JDK 9 include:
What’s New in JDK 9 - Identifies APIs, features, and options that were removed in JDK 9 as well as provides links to the documents where they are described in detail.
JSR 379: Java SE 9: Annex 1 - Documents changes to the specification made between Java SE 8 and Java SE 9. This document includes the identification of removed APIs and features not described here.
You should be aware of the contents in those documents as well as the items described on this page.
The descriptions below also identify potential compatibility issues that you might encounter when migrating to JDK 9. See the JDK 9 Migration Guide for descriptions of specific compatibility issues.
The Kinds of Compatibility page on the OpenJDK wiki identifies three types of potential compatibility issues for Java programs used in these descriptions:
Source: Source compatibility concerns translating Java source code into class files.
Binary: Binary compatibility is defined in The Java Language Specification as preserving the ability to link without error.
Behavioral: Behavioral compatibility includes the semantics of the code that is executed at runtime.
See the Compatibility & Specification Review (CSR) page on the OpenJDK wiki for more information about compatibility as it relates to JDK 9.
All methods that refer to types defined in the java.awt.peer and java.awt.dnd.peer packages (the "peer types") were removed from the Java API in Java SE 9 . Application code which calls any such method which accepts or returns a type defined in these packages will no longer link. This is a BINARY incompatible change.
Additional information is provided here: http://mail.openjdk.java.net/pipermail/awt-dev/2015-February/008924.html
com.sun.image.codec.jpeg has been shipped as a non-standard API since JDK 1.2. It was always advertised as a stop-gap measure until a proper standard equivalent was provided. That replacement (javax.imageio) has been there since JDK 1.4. As a result JDK 9 finally removes the long deprecated com.sun.image.codec.jpeg
API which has been flagged as intended for removal for several releases. Applications which still depend on it will need to be re-coded in order to run on JDK9.
The public static constant JFrame.EXIT_ON_CLOSE was removed in favour of WindowConstants.EXIT_ON_CLOSE.
The default java.policy
no longer grants stopThread
runtime permission in JDK 9.
In previous releases, untrusted code had the stopThread
runtime permission by default. This allows untrusted code to call Thread::stop
( on threads other than the current one ). Having an arbitrary exception thrown asynchronously is not something that trusted code should be expected to handle gracefully. So this permission is removed by default in JDK 9. The following line is deleted from the file conf/security/java.policy
: permission java.lang.RuntimePermission "stopThread";
The system property sun.lang.ClassLoader.allowArraySyntax
was introduced as a temporary workaround to give customers time to remove their source dependency on calling ClassLoader.loadClass
with the array syntax that is not supported since JDK 6. This temporary workaround is removed in JDK 9 and setting sun.lang.ClassLoader.allowArraySyntax
system property will have no effect to ClassLoader.loadClass
. Existing code that calls ClassLoader.loadClass
to create a Class
object of an array class shall be replaced with Class.forName
; otherwise it will get ClassNotFoundException
.
The netdoc
protocol handler has been removed in JDK 9. Code that attempts to construct a java.net.URL
with the netdoc
protocol, for example "netdoc:http://foo.com/index.html" will throw a MalformedURLException
.
The netdoc
protocol was used to point to network documents either on the local file system or externally through an HTTP URL. This capability is essentially defunct and is not supported by Safari, Firefox, and other major browsers.
The lib/content-types.properties
file has been removed from the Java run-time image. The lib/content-types.properties
file contained the default MIME content-types table used to map content type to file extension, etc, and is used primarily by the URLConnection API. The lib/content-types.properties
file was never intended to be user editable. Instead there is a system property, content.types.user.table
, that allows one to define their own content types.
See JDK-8039362, for further details on the use of content.types.user.table
.
Previous JDK releases documented how to configure java.net.InetAddress
to use the JNDI DNS service provider as the name service. This mechanism, and the system properties to configure it, have been removed in JDK 9.
A new mechanism to configure the use of a hosts file has been introduced.
A new system property jdk.net.hosts.file
has been defined. When this system property is set, the name and address resolution calls of InetAddress
, i.e getByXXX
, retrieve the relevant mapping from the specified file. The structure of this file is equivalent to that of the /etc/hosts
file.
When the system property jdk.net.hosts.file
is set, and the specified file doesn't exist, the name or address lookup will result in an UnknownHostException. Thus, a non existent hosts file is handled as if the file is empty.
The poll based SelectorProvider sun.nio.ch.PollSelectorProvider
has been removed in JDK 9. It has been superseded for several releases by improved or higher performance implementations on all supported platforms.
The mechanism of proxying RMI requests through HTTP, which was deprecated in Java SE 8, has been removed in Java SE 9. This mechanism used a web CGI script called java-rmi.cgi
. This script has also been removed. The default mechanism for transmitting RMI requests is now simply a direct socket connection.
The deprecated addPropertyListener
and removePropertyListener
methods have been removed from java.util.jar.Pack200.Packer
and java.util.jar.Pack200.Unpacker
. Applications that need to monitor progress of a packer or unpacker should poll the value of the PROGRESS
property instead.
The zip library implementation has been improved in JDK 9. The new java.util.zip.ZipFile implementation does not use mmap to map ZIP file central directory into memory anymore. As a result, the sun.zip.disableMemoryMapping
system property is no longer needed and has been removed.
The deprecated addPropertyListener
and removePropertyListener
methods have been removed from java.util.logging.LogManager
. Code that relies on a listener to be invoked when logging configuration changes should use the new addConfigurationListener
and removeConfigurationListener
methods instead.
javax.naming.Context.APPLET
has been deprecated. If the environment specified when creating an InitialContext
contains Context.APPLET
then it is ignored. Applets with JNDI configuration in applet parameters should use the Applet.getParameter(String)
method to read the parameters and use the values to create the JNDI context.
The possibility to provide provide subclasses of jdk.nashorn.internal.runtime.CodeStore through the java.util.ServiceLoader API has been removed in JDK 9.
The methods monitorEnter, monitorExit and tryMonitorEnter on sun.misc.Unsafe are removed in JDK 9. These methods are not used within the JDK itself and are very rarely used outside of the JDK.
The following unsupported APIs are removed:
com.sun.tracing
com.sun.tracing.dtrace
The Serviceability Agent (SA) Core and PID debugger Connectors have been removed in this release. It is no longer possible to use a Java Debugger to attach to a core file or process with the SA mechanism.
The JMX RMIConnector only supports the JRMP transport in JDK 9. Support for the optional IIOP transport has been removed in this release.
native2ascii tool is removed in JDK 9. JDK 9 supports UTF-8 based properties resource bundles (see JEP 226 and the conversion for UTF-8 based properties resource bundles to ISO-8859-1 is no longer needed.
management-agent.jar has been removed. Tools that have been using the Attach API to load this agent into a running VM should be aware that the Attach API has been updated in JDK 9 to define two new methods for starting a management agent:
com.sun.tools.attach.VirtualMachine.startManagementAgent(Properties agentProperties)
com.sun.tools.attach.VirtualMachine.startLocalManagementAgent()
The experimental/unsupported jhat
tool has been removed.
The serialver -show
option has been removed in this release.
The extcheck
tool has been removed in this release.
The experimental rmic -Xnew
option has been disabled for this release.
Support for serialized applets has been removed. The "OBJECT" attribute of the <APPLET>
tag and "object" and "java_object" applet parameter tags will no longer be recognized during applet launching, and will be ignored.
The -XX:SafepointPollOffset
flag has been removed because it was introduced only to reproduce a problem with the C1 compiler and is no longer needed.
The -XX:BackEdgeThreshold
flag has been removed because it is no longer supported. Users now need to use -XX:OnStackReplacePercentage
instead.
The -XX:EnableInvokeDynamic
flag has been removed because the VM does no longer support execution without invokedynamic.
The -XX:+Use486InstrsOnly
flag has been removed because it is no longer supported.
Per-thread compiler performance counters have been removed because they became obsolete in the presence of more fine-grained and precise compilation events. The corresponding interface in sun.management.*
has been deprecated since it will no longer provide information without the performance counters. Users can get similar or more fine-grained information via global performance counters, the event tracing API (JFR) or -XX:+PrintCompilation
.
These internal command line flags, which have been deprecated or aliased since JDK 6, have been removed:
CMSParPromoteBlocksToClaim
, ParCMSPromoteBlocksToClaim
, ParallelGCOldGenAllocBufferSize
, ParallelGCToSpaceAllocBufferSize
, UseGCTimeLimit
, CMSPermGenSweepingEnabled
, ResizeTLE
, PrintTLE
, TLESize
, UseTLE
, MaxTLERatio
, TLEFragmentationRatio
, TLEThreadRatio
In addition to this, these internal flags have been deprecated:
CMSMarkStackSizeMax
, ParallelMarkingThreads
, ParallelCMSThreads
, CMSMarkStackSize
, G1MarkStackSize
The GC combinations that were deprecated in JDK 8 have now been removed. This means that the following GC combinations no longer exist:
The command line flags that were removed are: -Xincgc, -XX:+CMSIncrementalMode, -XX:+UseCMSCompactAtFullCollection, -XX:+CMSFullGCsBeforeCompaction
and -XX:+UseCMSCollectionPassing
.
The command line flag -XX:+UseParNewGC
no longer has any effect. ParNew can only be used with CMS and CMS requires ParNew. Thus, the -XX:+UseParNewGC
flag has been deprecated and will likely be removed in a future release.
The VM Options -XX:AdjustConcurrency
and -XX:PrintJVMWarnings
are removed from JDK 9.
The VM option -XX:AdjustConcurrency
was only needed on Solaris 8/9 (when using the T1 threading library).
The VM option -XX:PrintJVMWarnings
was a development option only used by unimplemented VM functions that have themselves been removed in JDK 9.
On Oracle Solaris, the JDK and JRE no longer have an ISA (Instruction Specific Architecture) bin directory. The $JAVA_HOME/bin/sparcv9
and $JAVA_HOME/bin/amd64
directories, and the sym links in the directories, were present in JDK 8 to aid migration after 32-bit support was removed. Scripts or applications that rely on these locations should be updated to use $JAVA_HOME/bin
.
The lib/$ARCH directory, which used to contain native-code shared objects (.so files) for the VM and the libraries, has been removed and the contents has moved up one level into the lib/ directory.
Several deprecated and undocumented "impl_*" methods have been removed from JDK 9.
In prior releases, many public JavaFX classes in exported packages had public or protected implementation methods that were named with "impl_*" in the name, marked as "@Deprecated" with the stated intention of removing them, and hidden from the API documentation with the "@treatAsPrivate" javadoc tag.
These methods were never supported and were not intended to be used by applications. JavaFX applications that were using these undocumented methods will need to stop calling them.
The JavaFX builder classes, which were previously deprecated in JDK 8 with the stated intention to remove them, have been removed from JDK 9. JavaFX applications that use the builder classes should instead construct the needed scene graph objects directly and set the desired properties with the equivalent method calls.
The com.apple.concurrent.Dispatch
API was a Mac-only API and was carried into JDK 7u4 with the port of Apple's JDK 6 code. This seldom-used and unsupported API has been removed in JDK 9. Developers are encouraged to use the standard java.util.concurrent.Executor
and java.util.concurrent.ExecutorService
APIs instead.
The AppleScript engine implementing javax.script engine API has been removed without replacement. The AppleScript engine has worked inconsistently. The services configuration (META-INF/services) file was missing and only worked by accident when installing JDK 7 or JDK 8 on systems that had Apple's version of AppleScriptEngine.jar already on the system.
The JDK-specific annotation @jdk.Exported
has been removed in JDK 9. The information that @jdk.Exported
conveyed is now recorded in the exports declarations of modules. Tools that scan for this annotation should be updated to make use of the new API support in javax.lang.model
and java.lang.module
.
The javax.crypto.ExemptionMechanism.finalize() method has been removed from both the specification and the implementation.
The com.sun.security.auth.callback.DialogCallbackHandler
class has been removed. This class, which is in the JDK-specific extensions to JAAS, was deprecated in JDK 8 and previously flagged for removal.
The Launch-Time JRE Version Selection also known as Multiple JRE or mJRE functionality will no longer be available with the java launcher. This means the java launcher will not invoke another JRE version, and will exit with an error.
The presence of "-version:x.y.z", "-jre-restrict-search" and "-jre-no-restrict-search" on the java launcher's command-line will cause it to exit with an error message. The environment variable "JRE_VERSION_PATH" will be ignored.
The Java Archive (jar) manifest entry "JRE-version" will cause the java launcher to emit a warning, and "JRE-Restrict-Search" will be ignored.
Visual VM is a tool that provides information about code running on a Java Virtual Machine. It was provided with Oracle JDK 6, Oracle JDK 7, and Oracle JDK 8.
Starting from JDK 9, the tool (jvisualvm) is no longer included in Oracle JDK. Users can still download the tool from the official project website at https://visualvm.github.io