1 Prepare Java for Troubleshooting
This chapter contains the following sections:
Set Up Java for Troubleshooting
Set up the Java environment and command-line options to enable gathering relevant data for troubleshooting.
To set up Java, perform the following:
- Update the Java version: Use the latest Java version to avoid spending time on troubleshooting issues in Java that were fixed. Often, a problem caused by a bug in the Java runtime is fixed in the latest update release. Working with the latest Java version helps avoid some known and common issues.
- Set up the Java environment to debug: Consider the following scenarios while setting up a bigger Java application, starting an application with a launcher script, or running distributed Java on several machines.
Enable Options and Flags for JVM Troubleshooting
Set up JVM options and flags to enable gathering relevant data for troubleshooting.
The data you gather depends on the system and what data you would use in case you run into problems. Consider gathering the following data.
Gather Relevant Data
If your application runs into a problem and you want to debug the problem further, ensure that you collect any relevant data before restarting the system, especially if restarting will remove previous files.
Make a Java Application Easier to Debug
Using a logging framework is a good way to enable future debugging.
If you run into problems in a specific module, you should be able to enable logging in that module. It is also good to specify different levels of logging, for example info, debug, and trace. For more information about Java logging, see Java Logging Overview.