NoClassDefFoundError With JRockit But Not With Sun JDK

(Doc ID 941998.1)

Last updated on OCTOBER 04, 2010

Applies to:

Oracle JRockit - Version: R27.5 to R28 - Release: JRockit to JRockit
Information in this document applies to any platform.


You are getting a NoClassDefFoundError from JRockit but not from Sun JDK.

Below is your sample code. While executing, you are getting a NoClassDefFoundError from JRockit but not from Sun JDK.


public class PortCheck {
    public PortCheck() {
    public boolean isPortAvailable(int port) {

        System.out.println("isPortAvailable  no test  "+port);
        return true ;

    public static void main(String[] args) throws Exception {
        PortCheck p = new PortCheck();    
        boolean status = p.isPortAvailable(Integer.parseInt(args[0]));
        System.out.println("is port   "+  args[0] + " free = "+status);


import java.lang.reflect.Method;

public class ClassLoad {
    public ClassLoad() {

    public static void main(String[] args) throws Exception {
        Method method =
            URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {
URL.class });
        //Suppress access check.

        URL url = new File(args[0]).toURI().toURL();
                      new Object[] { url });
     PortCheck p = new PortCheck();
        boolean status = p.isPortAvailable(Integer.parseInt(args[1]));
      System.out.println("is port   "+  args[1] + " free = "+status);


Output from JRockit:

jrockit_160_05_R27.6.2-20/bin/java ClassLoad PortCheck.jar 8090
Exception in thread "Main Thread" java.lang.NoClassDefFoundError: PortCheck
at ClassLoad.main(

Output from Sun JDK:

jdk160_11/bin/java ClassLoad PortCheck.jar 8090
isPortAvailable no test 8090
is port 8090 free = true


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms