[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to debug a java application in Eclipse?

Posted on 2011-10-06
18
Medium Priority
?
1,857 Views
Last Modified: 2012-05-12
Hi,
When I debug my java code in Eclipse, I get the following issue:

<terminated, exit value: 0>C:\Program Files (x86)\Java\jre6\bin\javaw.exe (Oct 6, 2011 6:02:05 PM)	

Open in new window


and it does not debug my code.

Why do you think this happens?

Thanks,
0
Comment
Question by:Tolgar
  • 14
  • 4
18 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36927754
well it means that it runs fine without problems - exit code 0

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36927762
If you want to debug you need to set the breakpoints, etc.

In general when you have not such a big application it is easier to add System.out.println(..) statements - sorry this is only my opinion -
they''ll  all not approve of me.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36927772
You should put cursor to some placve in your code - then go tyo Run menu and click Toglle Break point

then you should start debugging - use this samml icon with a bug - it will stop at the place where you toggled braekpoint
0
Independent Software Vendors: 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!

 
LVL 47

Expert Comment

by:for_yan
ID: 36927789
And then when you click on the bug do down to Debug Configurations - here you should select your project and main class
and click button Debug and it will askk you if you want to switch to debug perspective and you say yes and then it will stop at
your break point line
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36927805
And then if you go to menu Run you'll now see more options there - like Step into , step Over, etc.
You can mostlynuse Step Into and on the right upper side (for me) it shows values of different variables there

Still it is all intimidating in my mind - still most mental work goes to where to put the break point and at wghich variable to look -
so I prefer to print out with System.out.println() insteda of all this Debug perspective
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36927819
in the right upper corner after you open Debug perspective - youll see button Java - with that button you can return back to Java perspective
0
 

Author Comment

by:Tolgar
ID: 36928083
Actually I did all these. I switched the view to debug perspective. And I can see my debug point. But in the code the little circles cannot be seen and Eclipse does not ask me if I wanna switch to debug mode when I say debug as java application.

So something is wrong. But I don't know why.

Do you have any idea?

Thanks,
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928105
Can you start with normal Java view - and you see Java code OK ?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928111
If so select some line in the code - go to Run and sleect ToggleBreakpoint - does it show blue dot on the margin of the code?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928122
If so, go to bug icon in the second row on the top (under menu) and click arrow next to it, then select Debug Configurations
then you should see popup window - make sure that you see your project name and your main class name.
then at the very bottom right of the popup window thwere is a buttion Debug - click on that - an it should ask you if you
want to switch to ebug perspective
0
 

Author Comment

by:Tolgar
ID: 36928248
1- Yes I can see the java code

2- No it does not show the blue dot

3- Yes I can see the project name and the class name under debug configurations

4- I clicked on the debug button but nothing changed.


0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928271
Can you place cursor in the code and modify it?
And when there is cursoe inside the code it still ddoes not show blue dot?
Don't know why that could be.
0
 

Author Comment

by:Tolgar
ID: 36928298
Yeah I can modify the code. and the blue dot never appears.

But when I switch to debug view manually. I can see the breakpoints on this view.

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928309
Well, that's OK - if you see it on Debug perspective then fine.
Then select Step Into on the Run menu(there should be also shortcut F-something)
and see how it steps through the program and sshows how you variables are changing
in the variables window
0
 

Author Comment

by:Tolgar
ID: 36928352
I didn't see the variables window. Where is it?

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928373
I see in the upper right side - there are two tables in that winodw - varaiables or breakpoints
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928380
Go to Window - Show View - maybe you need to slesct vriablaes window there
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36928384
It shows such icon: " (x)=variables"
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month19 days, 15 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question