defineClass doesn't exist on extended ClassLoader

Nathan Faulkner natedogith1 at
Fri Feb 23 01:39:47 UTC 2018

When extending java.lang.ClassLoader, I can't seem to execute defineClass.
Here's my test case showing the issue.

var superLoader =  Java.super(new (Java.extend(java.lang.ClassLoader))(){});
// defineClass on the super object doesn't exist for some reason
print("defineClass: " + (superLoader.defineClass !== undefined));
// definePackage is protected, but isn't undefined, so that isn't the issue
print("definePackage: " + (superLoader.definePackage !== undefined));

and here's the output of "java -version":
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

More information about the nashorn-dev mailing list