Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private static boolean alreadyInitialized() {
return false;
}

private static boolean isJdkTool() {
static boolean isJdkTool() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change for unit testing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I wanted to introduce a test for that, but I wanted make sure my test was sound before pushing it. Eventually in another PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not try pushing on patch release without proper testing.

Copy link
Copy Markdown
Contributor Author

@bric3 bric3 Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is very simple and reads a system property, like a few lines above.

I started tests here #11134

String moduleMain = SystemProperties.get("jdk.module.main");
if (null != moduleMain && !moduleMain.isEmpty() && moduleMain.charAt(0) == 'j') {
switch (moduleMain) {
Expand Down Expand Up @@ -253,6 +253,66 @@ private static boolean isJdkTool() {
return true;
}
}
// Handles JDK 8 tools (IBM J9 and standard JDK 8 vendors)
// jdk.module.main is only set for JDK 9+ module-based tools (already handled above)
String command = SystemProperties.get("sun.java.command");
if (null != command && !command.isEmpty()) {
// substring on first space
int firstSpace = command.indexOf(' ');
String mainClass = firstSpace > 0 ? command.substring(0, firstSpace) : command;
switch (mainClass) {
// IBM J9 JDK 8 specific tool main classes
case "com.ibm.crypto.tools.KeyTool": // keytool
case "com.ibm.security.krb5.internal.tools.Kinit": // kinit
case "com.ibm.security.krb5.internal.tools.Klist": // klist
case "com.ibm.security.krb5.internal.tools.Ktab": // ktab
case "com.ibm.jvm.dtfjview.DTFJView": // jdmpview
case "com.ibm.gsk.ikeyman.ikeycmd": // ikeycmd
case "com.ibm.CosNaming.TransientNameServer": // tnameserv
case "com.ibm.idl.toJavaPortable.Compile": // idlj
// Standard JDK 8 tool main classes (shared by IBM J9 and Oracle/OpenJDK 8)
case "sun.tools.jar.Main": // jar
case "com.sun.tools.javac.Main": // javac
case "com.sun.tools.javadoc.Main": // javadoc
case "com.sun.tools.javap.Main": // javap
case "com.sun.tools.javah.Main": // javah
case "sun.security.tools.keytool.Main": // keytool (Oracle/OpenJDK 8)
case "sun.security.tools.jarsigner.Main": // jarsigner
case "sun.security.tools.policytool.PolicyTool": // policytool
case "com.sun.tools.example.debug.tty.TTY": // jdb
case "com.sun.tools.jdeps.Main": // jdeps
case "sun.rmi.rmic.Main": // rmic
case "sun.rmi.registry.RegistryImpl": // rmiregistry
case "sun.rmi.server.Activation": // rmid
case "com.sun.tools.extcheck.Main": // extcheck
case "sun.tools.serialver.SerialVer": // serialver
case "sun.tools.native2ascii.Main": // native2ascii
case "com.sun.tools.internal.ws.WsGen": // wsgen
case "com.sun.tools.internal.ws.WsImport": // wsimport
case "com.sun.tools.internal.xjc.Driver": // xjc
case "com.sun.tools.internal.jxc.SchemaGenerator": // schemagen
case "com.sun.tools.script.shell.Main": // jrunscript
case "sun.tools.jconsole.JConsole": // jconsole
case "sun.applet.Main": // appletviewer
case "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer": // tnameserv
// (Oracle/OpenJDK 8)
case "com.sun.tools.corba.se.idl.toJavaPortable.Compile": // idlj (Oracle/OpenJDK 8)
case "com.sun.corba.se.impl.activation.ORBD": // orbd
case "com.sun.corba.se.impl.activation.ServerTool": // servertool
case "sun.tools.jps.Jps": // jps
case "sun.tools.jstack.JStack": // jstack
case "sun.tools.jmap.JMap": // jmap
case "sun.tools.jinfo.JInfo": // jinfo
case "com.sun.tools.hat.Main": // jhat
case "sun.tools.jstat.Jstat": // jstat
case "sun.tools.jstatd.Jstatd": // jstatd
case "sun.tools.jcmd.JCmd": // jcmd
case "jdk.jfr.internal.tool.Main": // jfr, backported to OpenJDK 8 in 8u262 (JEP 328
// backport, July 2020)
case "sun.jvm.hotspot.jdi.SADebugServer": // jsadebugd
return true;
}
}
return false;
}

Expand Down
Loading