Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


My Java application hang - how to investigate reasons of that?

Posted on 2010-11-14
Medium Priority
Last Modified: 2012-05-10

I have written some Java application (on PC), packaged it to JAR and started. But after some time it hang. According to a log files I can see that sometimes it happens after ArrayOutOfBounds exception.

My question is - what the usual/recommended ways to investigate and solve such issues?
I mean - what the usual/recommended Java debugging practices?

Is it possible to attach Java process with debugger and check stack, treads, variables and so on?

Run a debug session from Eclipse is not working in my case because my Java application has a specific model which (seems) could not be debugged from Eclipse.
So, yes, I'm writing code in Eclipse but cannot use it as debugger because some things do not work under the Eclipse debugger.
That is why I need something alike to attaching a running Java process with Java debugger and investigate it.
Is it possible at all? What tools/approaches could you could recommend?

Question by:Dmitry_Bond
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2

Expert Comment

ID: 34130871
I have  few suggestions and some questions.  When you say that you cannot use the Eclipse debugger do you mean than you cannot even run it from Eclipse.  To do this you can just right click on the code that contains your main function and click run as.  Then it will run directly from Eclipse you can view the output in the output window.  It will pop up if there is an exception.  The exception will then tell you which line of code it comes form and may even be a clickable link to take you straight there.
If you cannot run it in Eclipse exactly how are you running this.  Are you running this from a command line?  If not open up a command prompt, go to Start and then Run and type cmd.exe.  This will give you the commandline.  using cd navigate to the directory where your executable jar is and type java -jar <name executable jar>.  When you get your exception is should give you a stack trace that tells you where the error is occuring.
Otherwise you might want to look in to a profiler: http://www.yourkit.com/home/index.jsp or http://download.oracle.com/javase/6/docs/technotes/tools/share/jvisualvm.html
LVL 86

Expert Comment

ID: 34130877
>>According to a log files I can see that sometimes it happens after ArrayOutOfBounds exception.

That's strange. Normally that would terminate things, not hang them

>>That is why I need something alike to attaching a running Java process with Java debugger

If you can't debug it in Eclipse, you can't debug it in anything. It's possible that some of the binaries have no debug info, in which case they'll need to be recompiled.

Can you post a zip of the source?
LVL 86

Expert Comment

ID: 34130880
Also, please attach the log file if you can
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

LVL 92

Expert Comment

ID: 34132595
take a thread dump to determine why it has hung

Author Comment

ID: 34134362
> take a thread dump to determine why it has hung

Please provide some details how to do it?
Reference to tools and so on.
LVL 92

Accepted Solution

objects earned 750 total points
ID: 34134424

Assisted Solution

indigo23 earned 750 total points
ID: 34147163
try to use the jvisualvm, it is on %JAVA_HOME%/bin folder

Author Closing Comment

ID: 34430734
I cannot estimate answers because I was moved to another urgent project (non-java). So, the only thing I can do - close the question. Sorry.

Featured Post

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!

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:
Suggested Courses

730 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