user2818782
user2818782

Reputation: 756

Automatically attach Eclipse debugger

Is there a way to automatically attach the Eclipse debugger when my app starts?

I need to debug code that happens just as my process launches so it's difficult to attach the Eclipse debugger in time.

Perhaps a similar method to Debug.waitForDebugger() in JDK (not Android)?

Upvotes: 0

Views: 581

Answers (1)

user2818782
user2818782

Reputation: 756

In JVM DEBUG parameters there is a parameter called "suspend" which takes value as "y" or "n". so if you want to debug the process from start set this parameter as "suspend=y" and your Java application will wait until Eclipse remotely connect to it.

Otherwise if you want to run your program and later want eclipse to be connected that set this as "suspend=n" so your java application will run normally and after eclipse remotely connected to it, it will stop on breakpoints.

Read more: http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html#ixzz3x15ZQaIh

-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5000

Upvotes: 0

Related Questions