☕ JAVA-SPECIFIC GUIDANCE:
- Use Java Extension Pack (includes debugger)
- Ensure Java is compiled before debugging
- Set breakpoints in
.javafiles - Use 'java' debug configuration type
- Check JAVA_HOME environment variable
- Compilation: Ensure
.classfiles are up-to-date with source code - Classpath: Verify all dependencies are in the classpath
- Main Method: Set breakpoints inside the
mainmethod for entry point debugging - Exception Handling: Use breakpoints in
catchblocks to debug exceptions - Static vs Instance: Be aware of static context when debugging
{
"type": "java",
"request": "launch",
"name": "Launch Current File",
"mainClass": "${file}",
"console": "integratedTerminal"
}{
"type": "java",
"request": "launch",
"name": "Launch Main",
"mainClass": "com.example.Main",
"classPaths": ["${workspaceFolder}/target/classes"]
}- Use
System.out.println()for quick debugging - Leverage IDE features like "Evaluate Expression"
- Watch for
NullPointerExceptionand array index issues - Be aware of object references vs. primitive types
- Use conditional breakpoints for loops with many iterations
- Check for proper package declarations and imports
- ClassNotFoundException: Check classpath and package structure
- NoSuchMethodError: Ensure method signatures match between source and compiled code
- OutOfMemoryError: Monitor heap usage during debugging