title
How to Debug Java with VSCode
permalink
/java/
How to Debug Java with VSCode
OS
✅ MacOS
✅ Windows
? Linux
Break Point
✅ break point
✅ condition break point
❌ function breakpoint
Step Execution
✅ Step Over
✅ Step Into
✅ Step Out
✅ Continue
❌ Step Back
❌ Move To
❌ Pause
Variables
✅ variables views
✅ watch variables
Call Stack
Evaluation
✅ eval expression to show variables
❌ eval expression to change variables
Type of Execution
✅ debug unit test
✅ debug executable package
✅ remote debugging
{
"version" : " 0.2.0" ,
"configurations" : [
{
"type" : " java" ,
"name" : " Test Debug (Launch)" ,
"request" : " launch" ,
"mainClass" : " junit.textui.TestRunner" ,
"args" : " com.j74th.vscodedebugbook.bubblesort.BubbleSortTest"
}
]
}
{
"version" : " 0.2.0" ,
"configurations" : [
{
"type" : " java" ,
"name" : " Debug (Launch)" ,
"request" : " launch" ,
"mainClass" : " com.j74th.vscodedebugbook.bubblesort.BubbleSorter" ,
"args" : " 4 3 2 1"
}
]
}
attach running and remote process
{
"version" : " 0.2.0" ,
"configurations" : [
{
"type" : " java" ,
"name" : " Debug (Attach)" ,
"request" : " attach" ,
"hostName" : " localhost" ,
"port" : 5005
}
]
}
run program with debug option
set suspend=y when you like to stop before attach, othrewise suspend=n when you like to start right away.
java -cp target/classes -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5005,suspend=y com.j74th.vscodedebugbook.bubblesort.BubbleSorter 4 3 2 1
start debug