Skip to content

OpenJ9 fails to start if the classpath exactly matches the main class name #24634

Description

@paulcheeseman

The OpenJ9 JVM fails to start, with IBM Java 8 or any version of IBM Semeru, if the classpath is set to the same string value as the main class name.

For example:

$ java -cp Main Main
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

It doesn't matter whether the classpath is set on the command line as above, or via the CLASSPATH environment variable.

Using -verbose:init and _JAVA_LAUNCHER_DEBUG=true I narrowed the failure down to somewhere in JNI_CreateJavaVM() before this line:

|| (0 != addLauncherArgs(&j9portLibrary, args, launcherArgumentsSize, &vmArgumentsList,

(The debug string "Adding command line arguments" does not get printed in the failing scenario.)

Other JVM implementations (e.g. Hotspot) do not exhibit this issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions