RFR: 8211033: Clean up the processing -classpath argument not to set LM_CLASS

Jaikiran Pai jpai at openjdk.org
Fri Nov 8 10:45:30 UTC 2024


On Fri, 8 Nov 2024 09:28:07 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> On the surface this looks okay but just to double check: this has no impact on `java -cp <classpath> -jar app.jar`. The class path in that case is `app.jar`, the class path specified to -cp is ignored.

That's right - the launcher explicitly overrides the classpath in that case here https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjli/java.c#L313:


/* Override class path if -jar flag was specified */
if (mode == LM_JAR) {
    SetClassPath(what);     /* Override class path */
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21971#issuecomment-2464377538


More information about the core-libs-dev mailing list