Reputation:
It's hard to explain, but I'll try my best. There's a .jar file that opens up a GUI for a tournament environment. It's independent and I'm not given the source code. I need to code an agent in Java that competes in the tournament. When the .jar file opens, I can specify the path to my agent's class files in the GUI. This works fine. But I'm not sure how to debug this because the .jar file doesn't open in eclipse. I tried using external tools, which seems to run the .jar file but the GUI doesn't open up, so I can't specify the path to the agent. The tournament environment documentation doesn't really provide instructions to operate it without the GUI, so I really need to use just the GUI. Any way I can run this file through eclipse, so I can see how my own agent works with the environment and test/debug accordingly?
Additional info - this .jar also acts as a library which I was able to import into Eclipse without any issues.
Upvotes: 0
Views: 7894
Reputation: 1740
I've been using the JAD Eclipse plugin to reverse engineer jar libraries on the fly. http://jadclipse.sourceforge.net/wiki/index.php/Main_Page
However, it is worth to note that the decompiled source code does not exactly match the line numbers in stack traces.
Upvotes: 0
Reputation: 15215
It's hard to tell all of what's going on here, but there are a few things that can help.
First, you can start your app with the jar using command-line options like this:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n
Note that if you need to debug the startup code, you'll need to set "suspend=y", so the app will pause startup until you connect from the debugger.
In Eclipse, connect on port 8453.
Second, stepping through code that you don't have the source code for is not insurmountable. Install the "jd-eclipse" plugin, which you can get at http://jd.benow.ca/ . That will make that possible.
Upvotes: 5