4 Removed APIs

This section provides details about Java SE APIs that were removed in releases JDK 11 though JDK 26.

Run jdeprscan --release 26 -l --for-removal to get the list of APIs that are marked for removal in JDK 26.

Note:

The jdeprscan tool is available since JDK 9. If you want to print the list of deprecated APIs from earlier JDK versions, then replace the release number with the corresponding release version.

APIs Removed and Deprecated in Java SE 26

APIs Removed

The following APIs are removed in JDK 26:

Package

java.applet

Interfaces

java.applet.AppletContext
java.applet.AppletStub
java.applet.AudioClip
java.beans.AppletInitializer 

Classes

java.applet.Applet
javax.swing.JApplet 

Methods

java.beans.Beans.instantiate(ClassLoader,String,BeanContext,AppletInitializer)
java.lang.Thread.stop
java.net.DatagramSocketImpl.getTTL
java.net.DatagramSocketImpl.setTTL
java.net.MulticastSocket.getTTL
java.net.MulticastSocket.send
java.net.MulticastSocket.setTTL
javax.imageio.spi.ServiceRegistry.finalize
javax.imageio.stream.FileCacheImageInputStream.finalize
javax.imageio.stream.FileImageInputStream.finalize
javax.imageio.stream.FileImageOutputStream.finalize
javax.imageio.stream.ImageInputStreamImpl.finalize
javax.imageio.stream.MemoryCacheImageInputStream.finalize
javax.management.modelmbean.DescriptorSupport.toXMLString
javax.swing.RepaintManager.addDirtyRegion

Exception

javax.management.modelmbean.XMLParseException

Constructor

javax.management.modelmbean.DescriptorSupport.<init>()

APIs Proposed for Removal

The following APIs are proposed to be removed in future JDK releases:

Package

java.beans.beancontext

Interfaces

java.beans.beancontext.BeanContext
java.beans.beancontext.BeanContextChild
java.beans.beancontext.BeanContextChildComponentProxy
java.beans.beancontext.BeanContextContainerProxy
java.beans.beancontext.BeanContextMembershipListener
java.beans.beancontext.BeanContextProxy
java.beans.beancontext.BeanContextServiceProvider
java.beans.beancontext.BeanContextServiceProviderBeanInfo
java.beans.beancontext.BeanContextServiceRevokedListener
java.beans.beancontext.BeanContextServices
java.beans.beancontext.BeanContextServicesListener
java.security.Certificate
java.security.DomainCombiner
java.security.Policy.Parameters

Classes

java.awt.AWTPermission 
java.beans.beancontext.BeanContextChildSupport 
java.beans.beancontext.BeanContextEvent 
java.beans.beancontext.BeanContextMembershipEvent 
java.beans.beancontext.BeanContextServiceAvailableEvent 
java.beans.beancontext.BeanContextServiceRevokedEvent 
java.beans.beancontext.BeanContextServicesSupport 
java.beans.beancontext.BeanContextSupport 
java.io.FilePermission 
java.io.SerializablePermission 
java.lang.RuntimePermission 
java.lang.SecurityManager 
java.lang.management.ManagementPermission 
java.lang.reflect.ReflectPermission 
java.net.NetPermission 
java.net.URLPermission 
java.nio.file.LinkPermission 
java.rmi.RMISecurityManager 
java.security.AccessControlContext 
java.security.AccessController 
java.security.Identity 
java.security.IdentityScope 
java.security.Policy 
java.security.PolicySpi 
java.security.SecurityPermission 
java.security.Signer 
java.security.UnresolvedPermission 
java.util.PropertyPermission 
java.util.logging.LoggingPermission 
javax.management.MBeanPermission 
javax.management.MBeanServerPermission 
javax.management.MBeanTrustPermission 
javax.management.remote.SubjectDelegationPermission 
javax.net.ssl.SSLPermission 
javax.security.auth.AuthPermission 
javax.security.auth.PrivateCredentialPermission 
javax.security.auth.SubjectDomainCombiner 
javax.security.auth.kerberos.DelegationPermission 
javax.security.cert.Certificate 
javax.security.cert.X509Certificate 
javax.security.auth.kerberos.ServicePermission 
javax.sound.sampled.AudioPermission 
javax.swing.plaf.basic.BasicMenuItemUI.MouseInputHandler 
javax.swing.plaf.basic.BasicScrollPaneUI.HSBChangeListener 
javax.swing.plaf.basic.BasicScrollPaneUI.PropertyChangeHandler 
javax.swing.plaf.basic.BasicScrollPaneUI.ViewportChangeHandler 
javax.swing.plaf.basic.BasicScrollPaneUI.VSBChangeListener 
java.net.SocketPermission
java.sql.SQLPermission

Exceptions

java.lang.ThreadDeath
java.security.AccessControlException 
java.util.zip.ZipError 
javax.security.cert.CertificateEncodingException 
javax.security.cert.CertificateException 
javax.security.cert.CertificateExpiredException 
javax.security.cert.CertificateNotYetValidException 
javax.security.cert.CertificateParsingException 

Methods

java.awt.Graphics.finalize 
java.awt.PrintJob.finalize 
java.awt.Window.getWarningString 
java.beans.Beans.instantiate(ClassLoader,String,BeanContext) 
java.io.ObjectOutputStream.PutField.write 
java.lang.Enum.finalize 
java.lang.Object.finalize 
java.lang.Runtime.runFinalization 
java.lang.System.getSecurityManager 
java.lang.System.runFinalization 
java.lang.System.setSecurityManager 
java.lang.Thread.checkAccess 
java.lang.ThreadGroup.checkAccess 
java.lang.ThreadGroup.destroy 
java.lang.ThreadGroup.isDaemon 
java.lang.ThreadGroup.isDestroyed 
java.lang.ThreadGroup.setDaemon 
java.net.HttpURLConnection.getPermission 
java.net.URLConnection.getPermission 
java.util.concurrent.Executors.privilegedCallable 
java.util.concurrent.Executors.privilegedCallableUsingCurrentClassLoader 
java.util.concurrent.Executors.privilegedThreadFactory 
java.util.concurrent.ThreadPoolExecutor.finalize 
java.util.logging.LogManager.checkAccess 
javax.management.remote.JMXConnector.getMBeanServerConnection 
javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain 
javax.net.ssl.SSLSession.getPeerCertificateChain 
javax.security.auth.Subject.doAs(Subject,PrivilegedAction) 
javax.security.auth.Subject.doAs(Subject,PrivilegedExceptionAction) 
javax.security.auth.Subject.doAsPrivileged(Subject,PrivilegedAction,AccessControlContext) 
javax.security.auth.Subject.doAsPrivileged(Subject,PrivilegedExceptionAction,AccessControlContext) 
javax.security.auth.Subject.getSubject 
javax.swing.JInternalFrame.getWarningString 
javax.swing.plaf.basic.BasicDirectoryModel.intervalAdded 
javax.swing.plaf.basic.BasicDirectoryModel.intervalRemoved 
javax.swing.plaf.basic.BasicDirectoryModel.lt 
javax.swing.plaf.basic.BasicToolBarUI.createFloatingFrame 
java.lang.classfile.Signature.ClassTypeSig.of
java.net.ServerSocket.setPerformancePreferences
java.net.Socket.setPerformancePreferences
java.net.SocketImpl.setPerformancePreferences
 

Constructors

java.net.Socket.<init>(InetAddress,int,Boolean)
java.net.Socket.<init>(String,int,Boolean)
javax.management.relation.RoleStatus.<init>()

See Deprecated API section for more details about deprecations, including potential alternatives.

APIs Removed in Java SE 25

Methods

javax.swing.plaf.synth.SynthLookAndFeel.load 

Constructors

javax.swing.plaf.basic.BasicSliderUI.BasicSliderUI.<init>()

APIs Removed in Java SE 24

Fields

java.awt.Window.warningString 
javax.naming.Context.APPLET

APIs Removed in Java SE 23

Classes

javax.management.loading.MLet
javax.management.loading.MLetContent
javax.management.loading.MLetMBean
javax.management.loading.PrivateMLet

Methods

java.lang.Thread.resume
java.lang.Thread.suspend
java.lang.ThreadGroup.resume
java.lang.ThreadGroup.stop
java.lang.ThreadGroup.suspend

APIs Removed in Java SE 22

Methods

java.lang.Thread.countStackFrames

APIs Removed in Java SE 21

Classes

java.lang.Compiler
javax.management.remote.rmi.RMIIIOPServerImpl

Methods

java.lang.ThreadGroup.allowThreadSuspension(boolean)

APIs Removed in Java SE 20

No APIs were removed in this release.

APIs Removed in Java SE 19

No APIs were removed in this release.

APIs Removed in Java SE 18

Methods

 
          java.awt.color.ICC_Profile.finalize()
          java.awt.image.ColorModel.finalize()
          java.awt.image.IndexColorModel.finalize()
           

APIs Removed in Java SE 17

Packages

java.rmi.activation ()          

Classes


          java.rmi.activation.Activatable () 
          java.rmi.activation.ActivationDesc () 
          java.rmi.activation.ActivationGroup () 
          java.rmi.activation.ActivationGroup_Stub () 
          java.rmi.activation.ActivationGroupDesc () 
          java.rmi.activation.ActivationGroupID () 
          java.rmi.activation.ActivationID () 
          java.rmi.activation.ActivationInstantiator () 
          java.rmi.activation.ActivationMonitor () 
          java.rmi.activation.ActivationSystem () 
          java.rmi.activation.Activator () 

API Removed in Java SE 16

Constructor

javax.tools.ToolProvider.<init>()          

APIs Removed in Java SE 15

The following APIs have been removed in Java SE 15.

Fields

java.management.rmi.RMIConnectorServer.CREDENTIAL_TYPES      

Constructors

java.lang.invoke.ConstantBootstraps.<init> 
    java.lang.reflect.Modifier.<init>          

APIs Removed in Java SE 14

The following APIs have been removed in Java SE 14.

Packages
java.security.acl      

Interfaces

java.security.acl.Acl
java.security.acl.AclEntry
java.security.acl.Group
java.security.acl.Owner
java.security.acl.Permission
java.util.jar.Pack200.Packer    
java.util.jar.Pack200.Unpacker            
Classes
java.util.jar.Pack200      

APIs Removed in Java SE 13

The following APIs were removed in Java SE 13. Both of these APIs were deprecated and marked for removal with JDK 9. Both have been superseded by JVM-specific tracing mechanisms. See JVMTM Tool Interface specification.

java.lang.Runtime.traceInstructions(boolean)      
java.lang.Runtime.traceMethodCalls(boolean)

APIs Removed in Java SE 12

The following APIs were removed in Java SE 12.

            java.io.FileInputStream.finalize()      
            java.io.FileOutputStream.finalize()       
            java.util.zip.Deflater.finalize()       
            java.util.zip.Inflater.finalize()      
            java.util.zip.ZipFile.finalize()      

APIs Removed in JDK 11

The following APIs were removed in JDK 11. Many of these APIs were deprecated in previous releases and have been replaced by newer APIs.

javax.security.auth.Policy 
java.lang.Runtime.runFinalizersOnExit(boolean)
java.lang.SecurityManager.checkAwtEventQueueAccess() 
java.lang.SecurityManager.checkMemberAccess(java.lang.Class,int)
java.lang.SecurityManager.checkSystemClipboardAccess()
java.lang.SecurityManager.checkTopLevelWindow(java.lang.Object)
java.lang.System.runFinalizersOnExit(boolean)
java.lang.Thread.destroy()
java.lang.Thread.stop(java.lang.Throwable)

APIs Removed in JDK 10

The following common DOM APIs were removed in JDK 10.

com.sun.java.browser.plugin2.DOM
sun.plugin.dom.DOMObject

APIs Removed JDK 9

The following are some important APIs that have been removed from JDK 10 and JDK 9 releases.

Removed java.* APIs

The Java team is committed to backward compatibility. If an application runs in JDK 8, then it will run on JDK 9 and later releases as long as it uses APIs that are supported and intended for external use.

These include:

  • JCP standard, java.*, javax.*
  • JDK-specific APIs, some com.sun.*, some jdk.*

Supported APIs can be removed from the JDK, but only with notice. Find out if your code is using deprecated APIs by running the static analysis tool jdeprscan.

java.* APIs that were removed in JDK 9 include the previously deprecated methods from the java.util.logging.LogManager and java.util.jar.Pack200 packages:

java.util.logging.LogManager.addPropertyChangeListener
java.util.logging.LogManager.removePropertyChangeListener
java.util.jar.Pack200.Packer.addPropertyChangeListener
java.util.jar.Pack200.Packer.removePropertyChangeListener
java.util.jar.Pack200.Unpacker.addPropertyChangeListener
java.util.jar.Pack200.Unpacker.removePropertyChangeListener

Removal and Future Removal of sun.misc and sun.reflect APIs

Unlike the java.* APIs, almost all of the sun.* APIs are unsupported, JDK-internal APIs, and may go away at any time.

A few sun.* APIs were removed in JDK 9. Notably, sun.misc.BASE64Encoder and sun.misc.BASE64Decoder were removed. Instead, use the supported java.util.Base64 class, which was added in JDK 8.

If you use these APIs, you may wish to migrate to their supported replacements:

See JEP 260: Encapsulate Most Internal APIs.

java.awt.peer Not Accessible

The java.awt.peer and java.awt.dnd.peer packages aren’t accessible, starting in JDK 9. The packages were never part of the Java SE API, despite being in the java.* namespace.

All methods in the Java SE API that refer to types defined in these packages were removed from JDK 9. Code that calls a method that previously accepted or returned a type defined in these packages no longer compiles or runs.

There are two common uses of the java.awt.peer classes. You should replace them as follows:
  • To see if a peer has been set yet:
    if (component.getPeer() != null) { .. }
    Replace this with Component.isDisplayable() from the JDK 1.1 API:
    public boolean isDisplayable() {
    	return getPeer() != null;
  • To test if a component is lightweight:
    if (component.getPeer() instanceof LightweightPeer) ..
    Replace this with Component.isLightweight() from the JDK 1.2 API:
    public boolean isLightweight() {
    	return getPeer() instanceof LightweightPeer;

Removed com.sun.image.codec.jpeg Package

The nonstandard package com.sun.image.codec.jpeg has been removed. Use the Java Image I/O API instead.

The com.sun.image.codec.jpeg package was added in JDK 1.2 as a nonstandard way of controlling the loading and saving of JPEG format image files. It has never been part of the platform specification.

In JDK 1.4, the Java Image I/O API was added as a standard API, residing in the javax.imageio package. It provides a standard mechanism for controlling the loading and saving of sampled image formats and requires all compliant Java SE implementations to support JPEG based on the Java Image I/O specification.

Removed Tools Support for Compact Profiles

Starting in JDK 9, you can choose to build and run your application against any subset of the modules in the Java runtime image, without needing to rely on predefined profiles.

Profiles, introduced in Java SE 8, define subsets of the Java SE Platform API that can reduce the static size of the Java runtime on devices that have limited storage capacity. The tools in JDK 8 support three profiles, compact1, compact2, and compact3. For the API composition of each profile, see Detailed Profile Composition and API Reference in the JDK 8 documentation.

In JDK 8, you use the -profile option to specify the profile when running the javac and java commands. Starting in JDK 9, the -profile option is supported by javac only in conjunction with the --release 8 option, and isn’t supported by java.

JDK 9 and later releases let you choose the modules that are used at compile and run time. By specifying modules with the new --limit-modules option, you can obtain the same APIs that are in the compact profiles. This option is supported by both the javac and java commands, as shown in the following examples:

javac --limit-modules java.base,java.logging MyApp.java
java --limit-modules java.base,java.logging MyApp
The packages specified for each profile in Java SE 8 are exported, collectively, by the following sets of modules:
  • For the compact1 profile: java.base, java.logging, java.scripting

  • For the compact2 profile: java.base, java.logging, java.scripting, java.rmi, java.sql, java.xml

  • For the compact3 profile: java.base, java.logging, java.scripting, java.rmi, java.sql, java.xml, java.compiler, java.instrument, java.management, java.naming, java.prefs, java.security.jgss, java.security.sasl, java.sql.rowset, java.xml.crypto

You can use the jdeps tool to do a static analysis of the Java packages that are being used in your source code. This gives you the set of modules that you need to execute your application. If you had been using the compact3 profile, for example, then you may see that you don’t need to include that entire set of modules when you build your application. See jdeps in Java Development Kit Tool Specifications.

See JEP 200: The Modular JDK.