Reputation: 109
Hello every body I'm in a big dilemma. I'm triying to understand a piece of code in Java but I can`t.
Here is the scenario.
I have a class (Embed.java) that is invoked using a .bat file, but when I'm trying to debug the code in java classes I can´t do that because the debugger don´t stop on the break points in the java files. In addition when I execute a .bat file I don´t have an option to debug. If anybody could help me I appreciate that a lot.
In my .bat file I have the following code:
java Embed lopez.bmp lopez.jpg -c "" -e bin.noise -p pleasechangethispassphrasetoyourown
Where: Embed is the main class that is invoked and the other options are the inputs to that class.
Upvotes: 4
Views: 6290
Reputation: 109
Well after some days I got the solution to my deal.
First of all I did create a new .bat file that contains the following code:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 -mx40M Embed lopez.bmp lopez.jpg -c "" -e bin.noise -p pleasechangethispassphrasetoyourown
This file allows me make a remote debug to my application.
After that in eclipse I did configure to run my .bat file, to do this I used external tools configurations and then under the option program I created a new launch setting. In this window in the location option I entered the path to my new .bat file and in the option working directory I entered the path to the folder that contains my project. Now we can run this configuration, if everything is ok in the console of eclipse is displayed the following message:
Listening for transport dt_socket at address: 1044
Next in the option of debug configurations select the option remote java application and create a new one. In the options of this window just change the option port to 1044.
And that's all.
Upvotes: 6