Debug jar from Windows-launched Java App

 

I would like to debug a jar that runs in a Java application, but the application itself is launched by a Windows executable. I suspect the VM arguments are “hidden” behind the EXE and the faster route to debugging is to start the EXE from MyEclipse (or ME CI) rather than guess the main class and its arguments. My problem is I see no way to start the EXE from the Create, Manage and Run Configuration dialog. Is this task possible?

——

With the Java tooling, no – there isn’t a way to launch an EXE, and beyond that, for a Java debugging connection to be set up.

1) Finding the main class would probably be simpler – if it really is an app that’s launched via a main, and the launching exe isn’t doing something different. To find main, you could unzip the JAR(s) if not too many and examine MANIFEST.MF files, looking for the Main-Class property. Alternatively, you could add all the JARs to the build path of a dummy Java project, and then choose Debug As > Java Application – the dialog that pops up will list all the main classes it finds on the project’s classpath.

2) Remote debugging is another option, but that would require you to change the arguments passed to the Java application to have it wait / listen for a debug connection. You can then start it with the EXE and “attach” to it from MyEclipse. I only mention this as an option if you can think of some way to modify the arguments.

Hope this helps.

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注