• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1298
  • Last Modified:

How to debug a java code using jdb on command line?

Hi,
I have a jar file which I created using maven from my source code. How can I debug this jar file using jdb on the command line?

Thanks,
0
Tolgar
Asked:
Tolgar
1 Solution
 
for_yanCommented:
0
 
for_yanCommented:
Waht is your goal? Please, elaborate.
If you have source codes there are definitely easier ways to do it
0
 
TolgarAuthor Commented:
Well, I have my java code. For my application I create jar file from this code using maven and this code also uses some other external jar while creating the jar. Then my Perl code run and call this jar file with some input arguments.

So this is the first part of the story.

Now, I wanna pass these input arguments to my java code manually (either command line or Eclipse) and debug this code step by step.

If you will recommend me to do it in Eclipse please please write each step explicitly. I am having trouble in using Eclipse. Once it works, everything will be a lot easier.

Thanks,

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
for_yanCommented:

How big is the program ?
Do you want to learn using Eclipse and all this stuff or your goal is just to make this program work?
0
 
CEHJCommented:
It's always better to have a good logging strategy than to resort to debugging - particularly that kind of debugging
0
 
TolgarAuthor Commented:
@for_yan: First I want this program to work. But secondly, I want to learn and not struggle with this kind of obstacle again.

The code is not big. It is just one file around 500 lines of code. This code talks to a web application to update data.

Thanks,
0
 
for_yanCommented:
OK, do you know how to create a new empty propject in Eclipse?
0
 
TolgarAuthor Commented:
I think I know but there aren't only one.

File -> New - > Java Project 

Open in new window


or

File -> New - > Project 

Open in new window

0
 
for_yanCommented:
Yes,
File -> New - > Java Project
and then type the name
and then it will show next screen
and you can say OK there
0
 
TolgarAuthor Commented:
I said finish and now i have the project. I also added external jar which I will need them to run the code.

Now under the project I have these.

src
JRE System Library
Referenced Libraries

Open in new window


Now what am I gonna do?

Thanks
0
 
for_yanCommented:
OK.
No take your jar file - make  absolutely separate folder on your drive - put there .jar
copy it to another file and rename that another file to .zip
and then expand this .zip in here - in this folder where you are.

How many .java files do you have ?
Are they all in one folder?
0
 
TolgarAuthor Commented:
I copied the jar in a separate folder.
Renamed it as .zip
Expanded it

Now in that folder I have

com  and META-INF folders

couple of jar files (the libraries)

there are subfolders under com. Like mycompany>tools>projectName

and there is one .class file. But no .java files. Because I already compiled it in Maven.

What is next?





 
0
 
for_yanCommented:
Do you have original Java file(s)? Those which you compiled.
How many there are?
Are they all iin one folder?
0
 
TolgarAuthor Commented:
I have only one Java file. Here is the problem. They are in a Maven project structure. If I take them out then it won't work.

So what I heard is I need Maven plugin for Eclipse which gives the ability to import maven project into Eclipse.

Can we go with this direction?

Thanks,
0
 
Sathish David Kumar NCommented:
you cant traces the values in the jar file.
0
 
for_yanCommented:

> If I take them out then it won't work.
Java is java.

Well, I suggest you first at least learn how to use Eclipse in normal way.

0
 
TolgarAuthor Commented:
I installed maven plugin for eclipse.

Now how can I get this maven project into Maven?

File -> New ->Other -> Maven -> Maven Project


Then what am I gonna do?

0
 
for_yanCommented:


It should be Import ...> Maven projects as it says here:
http://stackoverflow.com/questions/2061094/importing-maven-project-into-eclipse


0
 
TolgarAuthor Commented:
ok i got it. THanks,
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now