blacksun
blacksun

Reputation: 733

Debugging a java jar file

I have a jar file and i don't have source. It should connect to a server. It doesn't run at the first time and i need to run it second time. I am trying to find a way to get it's logs. How can i enable it's logs?

Here is how i call it

java -Xms512m -Xmx512m -jar mcon.jar

I have found and tried the code below but i think it is for server sockets

java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n -jar mcon.jar

Upvotes: 3

Views: 2643

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53713

what you found is mostly correct but you do not need the address , that is to do remote debugging to connect to server

from command line , what you need is

java -agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=n -jar mcon.jar

then you can connect java debugger

jdb -attach jdbconn

you can refer to the doc to find out the command you can use

Upvotes: 1

Related Questions