@@ -216,7 +216,7 @@ private static boolean alreadyInitialized() {
216216 return false ;
217217 }
218218
219- private static boolean isJdkTool () {
219+ static boolean isJdkTool () {
220220 String moduleMain = SystemProperties .get ("jdk.module.main" );
221221 if (null != moduleMain && !moduleMain .isEmpty () && moduleMain .charAt (0 ) == 'j' ) {
222222 switch (moduleMain ) {
@@ -253,6 +253,66 @@ private static boolean isJdkTool() {
253253 return true ;
254254 }
255255 }
256+ // Handles JDK 8 tools (IBM J9 and standard JDK 8 vendors)
257+ // jdk.module.main is only set for JDK 9+ module-based tools (already handled above)
258+ String command = SystemProperties .get ("sun.java.command" );
259+ if (null != command && !command .isEmpty ()) {
260+ // substring on first space
261+ int firstSpace = command .indexOf (' ' );
262+ String mainClass = firstSpace > 0 ? command .substring (0 , firstSpace ) : command ;
263+ switch (mainClass ) {
264+ // IBM J9 JDK 8 specific tool main classes
265+ case "com.ibm.crypto.tools.KeyTool" : // keytool
266+ case "com.ibm.security.krb5.internal.tools.Kinit" : // kinit
267+ case "com.ibm.security.krb5.internal.tools.Klist" : // klist
268+ case "com.ibm.security.krb5.internal.tools.Ktab" : // ktab
269+ case "com.ibm.jvm.dtfjview.DTFJView" : // jdmpview
270+ case "com.ibm.gsk.ikeyman.ikeycmd" : // ikeycmd
271+ case "com.ibm.CosNaming.TransientNameServer" : // tnameserv
272+ case "com.ibm.idl.toJavaPortable.Compile" : // idlj
273+ // Standard JDK 8 tool main classes (shared by IBM J9 and Oracle/OpenJDK 8)
274+ case "sun.tools.jar.Main" : // jar
275+ case "com.sun.tools.javac.Main" : // javac
276+ case "com.sun.tools.javadoc.Main" : // javadoc
277+ case "com.sun.tools.javap.Main" : // javap
278+ case "com.sun.tools.javah.Main" : // javah
279+ case "sun.security.tools.keytool.Main" : // keytool (Oracle/OpenJDK 8)
280+ case "sun.security.tools.jarsigner.Main" : // jarsigner
281+ case "sun.security.tools.policytool.PolicyTool" : // policytool
282+ case "com.sun.tools.example.debug.tty.TTY" : // jdb
283+ case "com.sun.tools.jdeps.Main" : // jdeps
284+ case "sun.rmi.rmic.Main" : // rmic
285+ case "sun.rmi.registry.RegistryImpl" : // rmiregistry
286+ case "sun.rmi.server.Activation" : // rmid
287+ case "com.sun.tools.extcheck.Main" : // extcheck
288+ case "sun.tools.serialver.SerialVer" : // serialver
289+ case "sun.tools.native2ascii.Main" : // native2ascii
290+ case "com.sun.tools.internal.ws.WsGen" : // wsgen
291+ case "com.sun.tools.internal.ws.WsImport" : // wsimport
292+ case "com.sun.tools.internal.xjc.Driver" : // xjc
293+ case "com.sun.tools.internal.jxc.SchemaGenerator" : // schemagen
294+ case "com.sun.tools.script.shell.Main" : // jrunscript
295+ case "sun.tools.jconsole.JConsole" : // jconsole
296+ case "sun.applet.Main" : // appletviewer
297+ case "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer" : // tnameserv
298+ // (Oracle/OpenJDK 8)
299+ case "com.sun.tools.corba.se.idl.toJavaPortable.Compile" : // idlj (Oracle/OpenJDK 8)
300+ case "com.sun.corba.se.impl.activation.ORBD" : // orbd
301+ case "com.sun.corba.se.impl.activation.ServerTool" : // servertool
302+ case "sun.tools.jps.Jps" : // jps
303+ case "sun.tools.jstack.JStack" : // jstack
304+ case "sun.tools.jmap.JMap" : // jmap
305+ case "sun.tools.jinfo.JInfo" : // jinfo
306+ case "com.sun.tools.hat.Main" : // jhat
307+ case "sun.tools.jstat.Jstat" : // jstat
308+ case "sun.tools.jstatd.Jstatd" : // jstatd
309+ case "sun.tools.jcmd.JCmd" : // jcmd
310+ case "jdk.jfr.internal.tool.Main" : // jfr, backported to OpenJDK 8 in 8u262 (JEP 328
311+ // backport, July 2020)
312+ case "sun.jvm.hotspot.jdi.SADebugServer" : // jsadebugd
313+ return true ;
314+ }
315+ }
256316 return false ;
257317 }
258318
0 commit comments