Java Debugger for Visual Studio Code.
Clone or download
testforstephen Fix the issue that npm preLaunchTask does not exit (#519)
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
Latest commit 4a85531 Dec 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Enable bot to manage long inactivity issues (#353) Aug 7, 2018
.vscode Fix the issue that npm preLaunchTask does not exit (#519) Dec 19, 2018
images Add args/vmagrs test case (#447) Sep 27, 2018
scripts fix the ci error of https://travis-ci.org/Microsoft/vscode-java-debug… ( Jun 19, 2018
src Keep CodeLens config consistent with F5 generation (#509) Dec 11, 2018
test Enable travis (#84) Oct 10, 2017
testprojects Merge hotfix to master (#409) Sep 6, 2018
.editorconfig Refine codebase. (#13) Sep 18, 2017
.gitignore fix the ci error of https://travis-ci.org/Microsoft/vscode-java-debug… ( Jun 19, 2018
.travis.yml update travis to get rid of gulp3 issue on node 10 (#290) Apr 26, 2018
.vscodeignore check in test plan (#340) Jul 18, 2018
CHANGELOG.md Update 0.16.0 CHANGELOG (#511) Dec 12, 2018
CONTRIBUTING.md Add contributing instructions. (#429) Sep 20, 2018
LICENSE.txt Update license. (#42) Sep 22, 2017
README.md Add an user setting to control whether to build the workspace before … Dec 3, 2018
TestPlan.md Add args/vmagrs test case (#447) Sep 27, 2018
Troubleshooting.md Update mainClass configError troubleshooting info (#386) Aug 29, 2018
gulpfile.js Signal async task completion for GULP 4.0 (#362) Aug 13, 2018
logo.png Update product icon (#25) Sep 20, 2017
package-lock.json Bump version to 0.16.0 (#510) Dec 12, 2018
package.json Fix the issue that npm preLaunchTask does not exit (#519) Dec 19, 2018
package.nls.it.json Support Chinese Locale for launch configurations (#484) Nov 30, 2018
package.nls.json Add an user setting to control whether to build the workspace before … Dec 3, 2018
package.nls.zh.json Add an user setting to control whether to build the workspace before … Dec 3, 2018
tsconfig.json Fixing the versions in package.json and modify the tslint configurati… Oct 24, 2017
tslint.json Fixing the versions in package.json and modify the tslint configurati… Oct 24, 2017

README.md

Debugger for Java

Gitter Travis CI

Overview

A lightweight Java Debugger based on Java Debug Server which extends the Language Support for Java by Red Hat. It allows users to debug Java code using Visual Studio Code (VS Code). Here's a list of features:

  • Launch/Attach
  • Breakpoints/Conditional Breakpoints/Logpoints
  • Exceptions
  • Pause & Continue
  • Step In/Out/Over
  • Variables
  • Callstacks
  • Threads
  • Debug console
  • Evaluation
  • Hot Code Replace

Requirements

Install

Open VS Code and press F1 or Ctrl + Shift + P to open command palette, select Install Extension and type vscode-java-debug.

Or launch VS Code Quick Open (Ctrl + P), paste the following command, and press enter.

ext install vscode-java-debug

Use

  • Launch VS Code
  • Open a Java project (Maven/Gradle/Eclipse)
  • Open a Java file to activate the extensions
  • Add debug configurations and edit launch.json
    • To launch: specify mainClass
    • To attach: specify hostName and port
  • Press F5

Please also check the documentation of Language Support for Java by Red Hat if you have trouble setting up your project.

Options

Launch

  • mainClass (required) - The fully qualified class name (e.g. [java module name/]com.xyz.MainApp) or the java file path of the program entry.
  • args - The command line arguments passed to the program. Use "${command:SpecifyProgramArgs}" to prompt for program arguments. It accepts a string or an array of string.
  • sourcePaths - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
  • modulePaths - The modulepaths for launching the JVM. If not specified, the debugger will automatically resolve from current project.
  • classPaths - The classpaths for launching the JVM. If not specified, the debugger will automatically resolve from current project.
  • encoding - The file.encoding setting for the JVM. If not specified, 'UTF-8' will be used. Possible values can be found in http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html.
  • vmArgs - The extra options and system properties for the JVM (e.g. -Xms<size> -Xmx<size> -D<name>=<value>), it accepts a string or an array of string.
  • projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
  • cwd - The working directory of the program. Defaults to ${workspaceFolder}.
  • env - The extra environment variables for the program.
  • stopOnEntry - Automatically pause the program after launching.
  • console - The specified console to launch the program. Defaults to internalConsole.
    • internalConsole - VS Code debug console (input stream not supported).
    • integratedTerminal - VS Code integrated terminal.
    • externalTerminal - External terminal that can be configured in user settings.
  • stepFilters - Skip specified classes or methods when stepping.
    • classNameFilters - Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipSynthetics - Skip synthetic methods when stepping.
    • skipStaticInitializers - Skip static initializer methods when stepping.
    • skipConstructors - Skip constructor methods when stepping.

Attach

  • hostName (required) - The host name or IP address of remote debuggee.
  • port (required) - The debug port of remote debuggee.
  • timeout - Timeout value before reconnecting, in milliseconds (default to 30000ms).
  • sourcePaths - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
  • projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
  • stepFilters - Skip specified classes or methods when stepping.
    • classNameFilters - Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipSynthetics - Skip synthetic methods when stepping.
    • skipStaticInitializers - Skip static initializer methods when stepping.
    • skipConstructors - Skip constructor methods when stepping.

User Settings

  • java.debug.logLevel: minimum level of debugger logs that are sent to VS Code, defaults to warn.
  • java.debug.settings.showHex: show numbers in hex format in "Variables" viewlet, defaults to false.
  • java.debug.settings.showStaticVariables: show static variables in "Variables" viewlet, defaults to true.
  • java.debug.settings.showQualifiedNames: show fully qualified class names in "Variables" viewlet, defaults to false.
  • java.debug.settings.maxStringLength: the maximum length of string displayed in "Variables" or "Debug Console" viewlet, the string longer than this length will be trimmed, defaults to 0 which means no trim is performed.
  • java.debug.settings.enableHotCodeReplace: enable hot code replace for Java code. Make sure the auto build is not disabled for VSCode Java. See the wiki page for more information about usages and limitations.
  • java.debug.settings.enableRunDebugCodeLens: enable the code lens provider for the run and debug buttons over main entry points, defaults to true.
  • java.debug.settings.forceBuildBeforeLaunch: force building the workspace before launching java program, defaults to true.

Troubleshooting

Reference the troubleshooting guide for common errors.

Feedback and Questions

You can find the full list of issues at Issue Tracker. You can submit a bug or feature suggestion, and participate community driven Gitter

License

This extension is licensed under MIT License.

Data/Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don't wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.