痛风是什么引起的| 寒湿吃什么中成药| 锋字五行属什么| 身败名裂是什么意思| 什么是道| 茶油是什么油| 出淤泥而不染是什么花| 什么是ct检查| 主动脉迂曲是什么意思| crispy是什么意思| 冠状沟有白色分泌物是什么原因| 痰多吃什么好| 口苦口臭吃什么药| 阴火是什么意思| 为什么会有黑头| 手心脚心发热是什么原因引起的| 维生素c弱阳性是什么意思| 天蝎座与什么星座最配| 臭虫最怕什么| 企业性质指的是什么| 景气是什么意思| 什么粉一沾就痒还看不出来| 顺流而下什么意思| 云服务是什么| 4月25号是什么星座| 什么疲倦| 01年属什么的| 六月初一有什么讲究| 蟹黄是螃蟹的什么东西| 美国为什么叫美国| 呕吐后吃什么食物好| 内分泌科主要看什么| 痧是什么| 辣椒有什么营养价值| 大便失禁是什么原因| 拔冗是什么意思| 血压高吃什么| 甲亢与甲减有什么区别| rov是什么意思| 四面八方是什么意思| 右眼皮跳是什么原因| 水泻拉肚子是什么原因| 什么鱼是深海鱼| aed是什么| 阳气最强的树是什么树| 双氧水是什么东西| 安全期是什么| 球蛋白有什么作用和功效| 心火旺失眠吃什么药| 人质是什么意思| 后是什么意思| 空腔是什么意思| mandy英文名什么意思| 双十一从什么时候开始| 男人下面出汗是什么原因| 上号是什么意思| 鼻子大的男人说明什么| 粉皮是什么做的| 梦见很多肉是什么意思| 清炖鸡放什么调料| 5月6日是什么星座| 刚怀孕肚子有什么变化| 贫血吃什么维生素| 润喉咙什么东西最合适| 肚子痛挂什么科| 低压高有什么危险| 三个句号代表什么意思| 老实忠厚是什么生肖| 什么是接触性皮炎| 大脖子病有什么症状| 阅读是什么意思| 为什么会得腱鞘炎| 乳铁蛋白对宝宝有什么好处| 串联质谱筛查是什么病| 迷走神经是什么| 房速与房颤有什么区别| 捞人什么意思| 松鼠是什么生肖| 肝主筋的筋是指什么| 长期腹泻是什么原因| 自身免疫性胃炎是什么意思| au是什么金属| 拜阿司匹灵是什么药| 肝病去医院挂什么科| 汆水是什么意思| 雷锋原名叫什么| vt是什么| 侍妾是什么意思| 猪脚炖什么| 行代表什么生肖| 山合念什么| 捆鸡是什么做的| 最高位是什么位| 五指毛桃什么人不能吃| 椅子像什么| 迪奥是什么品牌| o型b型生的孩子是什么血型| 小限是什么意思| 做梦梦见蛇是什么征兆| 小孩晚上睡不着是什么原因| 女性脱发严重是什么原因引起的| 尿频尿急小腹胀痛吃什么药| 润喉喝什么| 血脂高吃什么食物好| 中暑头晕吃什么药| 人乳头瘤病毒18型阳性是什么意思| 电压高是什么原因造成| anxiety什么意思| 左手中指痛什么预兆| 胸闷喘不上气什么原因| 去香港需要准备什么| 生源地是指什么| 大便颗粒状是什么原因造成的| 火烧是什么食物| 栀子有什么作用与功效| 吃什么会变丑脑筋急转弯| 检查甲状腺挂什么科| 音欠读什么| 问是什么结构| 豆汁是什么做的| 景深是什么意思| 炖大骨头放什么调料| 腾空是什么意思| 什么的野鸡| 检验葡萄糖用什么试剂| bq是什么意思| 急性扁桃体炎什么原因导致的| 血压为什么会高| 草莓是什么季节的| 舌苔发黄是什么原因| 脾疼是什么原因| 69年什么时候退休| 硒是什么意思| mra是什么牌子| 糖尿病吃什么好| 欺凌是什么意思| 寡糖是什么| 伤寒现在叫什么病| 让我爱你然后把我抛弃是什么歌| 日行一善下一句是什么| 激凸是什么意思| 绞股蓝有什么作用| 银川有什么特产| angry是什么意思| 肝脏在人体的什么位置| 妈妈的哥哥的老婆叫什么| 眼睛浮肿是什么原因| 沙眼是什么原因引起的| icloud是什么| 白介素高说明什么| 蟾蜍是什么动物| 老年人出现幻觉是什么原因| 我国计划生育什么时候开始| 什么是躯体化| 办身份证需要准备什么| 12月18是什么星座| 加尿素起什么作用| 妊娠期是什么意思| 精神出轨是什么意思| 吴佳尼为什么嫁马景涛| 磷高吃什么药| youtube是什么软件| 上皮细胞是什么| 长血痣是什么原因| 女人消瘦应该检查什么| 办慢性病有什么好处| 高血压和高血脂有什么区别| 晚上八点多是什么时辰| 别出心裁的裁是什么意思| 尿毒清颗粒主治什么病| 河水像什么| 什么烟比较好抽| 天干是什么意思| 多晒太阳有什么好处| 313什么意思| 低血压吃什么食物| 麻醉剂是什么| 相爱相杀是什么意思| 26岁属什么的生肖| 梦到蜘蛛是什么意思| 金代表什么数字| 吃大米配什么菜| 什么颜色最防晒| 吃猪肝有什么好处| 牡丹王是什么茶| 按摩脚底有什么好处| 视功能是什么| 奥硝唑和甲硝唑有什么区别| 尿急尿痛吃什么药| 有主见是什么意思| 蒙脱石散是什么| 狗取什么名字好| 小便尿血是什么原因| 巨蟹女跟什么星座最配| 1993年什么命| 长豆角叫什么| 恐龙吃什么| 庚是什么意思| 眉目比喻什么| 毕罗是什么食物| 烂尾是什么意思| 气管炎吃什么好| 手指没有月牙是什么原因| 出来混迟早要还的什么意思| 溶血性黄疸是什么原因引起的| 为什么晚上睡觉会磨牙| 自愿离婚要带什么证件| 高胆固醇血症是什么病| 网络绿茶是什么意思| 医院洗牙挂什么科| 四面楚歌是什么意思| 芒果有什么功效| 燕麦长什么样子图片| 肝阳虚吃什么中成药| 诸法无我是什么意思| 什么茶好喝| 接吻会传染什么病| 肌酐清除率是什么意思| 海里是什么单位| 微波炉不热是什么原因| 胃痉挛什么症状| holly是什么意思| 虐猫是什么意思| 2024年属龙的是什么命| 巨细胞病毒igm阳性是什么意思| 6月23日什么星座| 头晕吃什么药好| 股癣是什么样子的图片| 宫颈ecc是什么意思| 什么是高筋面粉| 阅兵什么意思| 师长相当于地方什么级别| 38码衣服相当于什么码| 白天不咳嗽晚上咳嗽是什么原因| 血小板低是什么症状| 皮什么结构| 大力念什么| pet-ct主要检查什么| 马齿苋长什么样子| 深蓝色是什么颜色| 胃肠蠕动慢吃什么药| 瘦人吃什么能长胖| 孕妇拉肚子可以吃什么药| 李白和杜甫并称什么| 轴重是什么意思| ctc什么意思| 梦见烧火做饭是什么意思| 乙肝阳性是什么意思| 盆腔积液有什么症状有哪些| 少量盆腔积液是什么意思| 两肺散在小结节是什么意思| 为什么手比脸白那么多| 19年是什么年| 为什么会突然流鼻血| 一什么圆月| 上胸围90下胸围80是什么罩杯| 驴打滚是什么意思| 痱子吃什么药| 胰岛素是干什么用的| ifashion是什么意思| 小马拉大车什么意思| 窦性心动过缓吃什么药| 女生安全期是什么意思| 淀粉是什么粉| 百度

Try to extend agent mode in VS Code!

诺奖得主席勒:美国梦已变买房梦,中国梦或可推动经济成功

百度 2014年底,在外经商的她高票当选村党支部书记,上任后她一心扑在工作上,修路、造田、兴建水利,努力改变村庄面貌。

Visual Studio Code allows you to debug Java applications through the Debugger for Java extension. It's a lightweight Java debugger based on Java Debug Server, which extends the Language Support for Java? by Red Hat.

Here's a list of supported debugging features:

  • Launch/Attach
  • Breakpoints
  • Exceptions
  • Pause & Continue
  • Step In/Out/Over
  • Variables
  • Call Stacks
  • Threads
  • Debug Console
  • Evaluation
  • Hot Code Replace

The Java debugger is an open-source project, which welcomes contributors to collaborate through GitHub repositories:

If you run into any issues when using the features below, you can contact us by entering an issue.

Install

To get the complete Java language support in Visual Studio Code, you can install the Extension Pack for Java, which includes the Debugger for Java extension.

Install the Extension Pack for Java

For details on how to get started with the extension pack, you can review the Getting Started with Java tutorial.

Configure

By default, the debugger will run out-of-box by automatically finding the main class and generating a default launch configuration in memory to launch your application.

If you would like to customize and persist your launch configuration, you can select the create a launch.json file link in the Run and Debug view.

Debug Menu

The launch.json file is located in a .vscode folder in your workspace (project root folder).

For more details on how to create the launch.json, read Launch configurations; for more details on configuration options for Java, you can read Configuration options.

Run and Debug

The debugger extension provides multiple ways to run and debug your Java application.

Run from CodeLens

You will find Run|Debug on the CodeLens of your main() function.

CodeLens

Run from Editor menu

Another way to start debugging is to select Run Java or Debug Java menu from the top editor title bar.

EditorMenu

Run from pressing F5

Pressing F5, the debugger will automatically find the entry point of your project and start debugging. You can also start a debugging session from the Run and Debug view from the side bar of VS Code. See more at Debugging in VS Code.

Debugging single files

In addition to support for debugging Java projects managed by build tools, VS Code also supports for debugging single Java files without any project.

Debug session inputs

The default Debug Console in VS Code doesn't support inputs. If your program needs inputs from a terminal, you can use the Integrated Terminal (?` (Windows, Linux Ctrl+`)) within VS Code or an external terminal to launch it. You can also use the user setting java.debug.settings.console to configure a global console for all Java debug sessions.

Breakpoints

The Debugger for Java supports various breakpoints, such as line breakpoints, conditional breakpoints, data breakpoints, and logpoints.

Breakpoint - Conditional breakpoint

With the help of expression evaluation, the debugger also supports conditional breakpoints. You can set your breakpoint to break when the expression evaluates to true.

Breakpoint - Data breakpoint

You can have the debugger break when a variable changes its value. Note that the data breakpoint can only be set inside a debug session. This means you need to launch your application and break on a regular breakpoint first. You can then pick a field in the VARIABLES view and set a data breakpoint.

Data Breakpoint

Breakpoint - Logpoints

Logpoints are also supported by the Java Debugger. Logpoints allow you to send output to the Debug Console without editing code. They're different from breakpoints because they don't stop the execution flow of your application.

Breakpoint - Triggered breakpoints

A triggered breakpoint is a breakpoint that is automatically enabled once another breakpoint is hit. They can be very useful when diagnosing failure cases in code that happen only after a certain precondition.

Triggered breakpoints can be set by right-clicking on the glyph margin, selecting Add Triggered Breakpoint, and then choosing which other breakpoint enables the breakpoint.

Expression evaluation

The debugger also lets you evaluate expressions in the WATCH window as well as the Debug Console.

Hot Code Replace

Another advanced feature the debugger supports is 'Hot Code' replacement. Hot Code Replace (HCR) is a debugging technique whereby the Debugger for Java transmits the class changes over the debugging channel to another Java Virtual Machine (JVM). HCR facilitates experimental development and fosters iterative trial-and-error coding. With this new feature, you can start a debugging session and change a Java file in your development environment, and the debugger will replace the code in the running JVM. No restart is required, which is why it's called "hot". Below is an illustration of how you can use HCR with Debugger for Java in VS Code.

You may use the debug setting java.debug.settings.hotCodeReplace to control how to trigger Hot Code Replace. The possible setting values are:

  • manual - Click the toolbar to apply the changes (default).
  • auto - Automatically apply the changes after compilation.
  • never - Disable Hot Code Replace.

Step filtering

Step filtering is supported by the extension to filter out types that you do not want to see or step through while debugging. With this feature, you can configure the packages to filter within your launch.json so they can be skipped when you step through.

Configuration options

There are many options and settings available to configure the debugger. For example, configuring the JVM arguments and environment variables is easily done with launch options.

Consult the documentation for the Language Support for Java? by Red Hat extension for help with setting up your project.

For many commonly used setups, there are samples available in VS Code Java Debugger Configuration. The document explains how the Java debugger automatically generates configurations for you, and if you need to modify them, how to do so with the main class, different arguments, environment, attaching to other Java processes, and usage of more advanced features.

Below are all the configurations available for Launch and Attach. For more information about how to write the launch.json file, refer to Debugging.

Launch

  • mainClass (required) - The fully qualified class name (for example [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 strings.
  • 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.
    • $Auto - Automatically resolve the modulepaths of current project.
    • $Runtime - The modulepaths within 'runtime' scope of current project.
    • $Test - The modulepaths within 'test' scope of current project.
    • !/path/to/exclude - Exclude the specified path from modulepaths.
    • /path/to/append - Append the specified path to the modulepaths.
  • classPaths - The classpaths for launching the JVM. If not specified, the debugger will automatically resolve from current project.
    • $Auto - Automatically resolve the classpaths of current project.
    • $Runtime - The classpaths within 'runtime' scope of current project.
    • $Test - The classpaths within 'test' scope of current project.
    • !/path/to/exclude - Exclude the specified path from classpaths.
    • /path/to/append - Append the specified path to the classpaths.
  • encoding - The file.encoding setting for the JVM. If not specified, 'UTF-8' will be used. Possible values can be found in Supported Encodings.
  • vmArgs - The extra options and system properties for the JVM (for example -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.
  • envFile - Absolute path to a file containing environment variable definitions.
  • stopOnEntry - Automatically pause the program after launching.
  • console - The specified console to launch the program. If not specified, use the console specified by the java.debug.settings.console user setting.
    • internalConsole - VS Code Debug Console (input stream not supported).
    • integratedTerminal - VS Code Integrated Terminal.
    • externalTerminal - External terminal that can be configured in user settings.
  • shortenCommandLine - When the project has long classpath or big VM arguments, the command line to launch the program may exceed the maximum command-line string limitation allowed by the OS. This configuration item provides multiple approaches to shorten the command line. Defaults to auto.
    • none - Launch the program with the standard command line 'java {options} classname {args}'.
    • jarmanifest - Generate the classpath parameters to a temporary classpath.jar file, and launch the program with the command line 'java -cp classpath.jar classname {args}'.
    • argfile - Generate the classpath parameters to a temporary argument file, and launch the program with the command line 'java @argfile {args}'. This value only applies to Java 9 and higher.
    • auto - Automatically detect the command-line length and determine whether to shorten the command line via an appropriate approach.
  • stepFilters - Skip specified classes or methods when stepping.
    • classNameFilters - [Deprecated - replaced by skipClasses] Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipClasses - Skip the specified classes when stepping. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, for example java.*, *.Foo.
    • 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.
  • processId - Use process picker to select a process to attach, or Process ID as integer.
    • ${command:PickJavaProcess} - Use process picker to select a process to attach.
    • An integer PID - Attach to the specified local process.
  • timeout - Time out value before reconnecting, in milliseconds (default to 30000 ms).
  • 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 - [Deprecated - replaced by skipClasses] Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipClasses - Skip the specified classes when stepping. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, for example java.*, *.Foo.
    • 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, defaults to false.
  • java.debug.settings.showStaticVariables: Show static variables in Variables, defaults to false.
  • java.debug.settings.showQualifiedNames: Show fully qualified class names in Variables, defaults to false.
  • java.debug.settings.showLogicalStructure: Show the logical structure for the Collection and Map classes in Variables, defaults to true.
  • java.debug.settings.showToString: Show 'toString()' value for all classes that override 'toString' method in Variables, defaults to true.
  • java.debug.settings.maxStringLength: The maximum length of strings displayed in Variables or Debug Console. Strings longer than this limit will be trimmed. The default is 0, which means no trim is performed.
  • java.debug.settings.hotCodeReplace: Reload the changed Java classes during debugging, defaults to manual. Make sure java.autobuild.enabled is not disabled for the Java Language Support extension. See the Hot Code Replace wiki page for more information about usages and limitations.
    • manual - Click the toolbar to apply the changes.
    • auto - Automatically apply the changes after compilation.
    • never - Never apply the changes.
  • java.debug.settings.enableHotCodeReplace: Enable Hot Code Replace for Java code. Make sure the auto build is not disabled for VS Code Java. See the Hot Code Replace wiki page for more information about usages and limitations.
  • java.debug.settings.enableRunDebugCodeLens: Enable the CodeLens 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.
  • java.debug.settings.console: The specified console to launch a Java program, defaults to integratedTerminal. If you want to customize the console for a specific debug session, please modify the console configuration in launch.json.
    • internalConsole - VS Code Debug Console (input stream not supported).
    • integratedTerminal - VS Code Integrated Terminal.
    • externalTerminal - External terminal that can be configured in user settings.
  • java.debug.settings.exceptionBreakpoint.skipClasses: Skip the specified classes when breaking on exception. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, for example java.*, *.Foo.
  • java.debug.settings.stepping.skipClasses: Skip the specified classes when stepping. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, for example java.*, *.Foo.
  • java.debug.settings.stepping.skipSynthetics: Skip synthetic methods when stepping.
  • java.debug.settings.stepping.skipStaticInitializers: Skip static initializer methods when stepping.
  • java.debug.settings.stepping.skipConstructors: Skip constructor methods when stepping.
  • java.debug.settings.jdwp.limitOfVariablesPerJdwpRequest: The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout. Defaults to 100.
  • java.debug.settings.jdwp.requestTimeout: The timeout (ms) of JDWP request when the debugger communicates with the target JVM. Defaults to 3000.
  • java.debug.settings.vmArgs: The default VM arguments to launch the Java program. For example, use '-Xmx1G -ea' to increase the heap size to 1 GB and enable assertions. If you want to customize the VM arguments for a specific debug session, you can modify the 'vmArgs' config in launch.json.
  • java.silentNotification: Controls whether notifications can be used to report progress. If true, use status bar to report progress instead. Defaults to false.

Troubleshooting

If you encounter issues when using the debugger, a detailed troubleshooting guide can be found in the vscode-java-debug GitHub repository.

Common issues explained include:

  • Java Language Support extension fails to start.
  • Build failed, do you want to continue?
  • *.java isn't on the classpath. Only syntax errors will be reported.
  • Program Error: Could not find or load main class X.
  • Program throws ClassNotFoundException.
  • Failed to complete Hot Code Replace.
  • Please specify the host name and the port of the remote debuggee in the launch.json.
  • Failed to evaluate. Reason: Cannot evaluate because the thread is resumed.
  • Cannot find a class with the main method.
  • No delegateCommandHandler for vscode.java.startDebugSession when starting Debugger.
  • Failed to resolve classpath.
  • Request type "X" is not supported. Only "launch" and "attach" are supported.

Feedback and questions

You can find the full list of issues at the vscode-java-debug repository. You can submit a bug or feature suggestion and participate in the community driven vscode-java-debug Gitter channel.

Next steps

Read on to find out about:

  • Debugging - Find out how to use the debugger in VS Code with your project for any language.

And for Java:

  • Java testing - Test Java within VS Code with the Java Test Runner extension.
  • Java extensions - Learn about more useful Java extensions for VS Code.
葛根是什么植物的根 graff是什么牌子 1944年属什么 甲状腺什么症状 左胸疼什么原因
伪军是什么意思 市政协常委是什么级别 柏拉图之恋是什么意思 12月16是什么星座 铁蛋白是什么
单脐动脉对胎儿有什么影响 怀孕一个月出血是什么情况 脸肿眼睛肿是什么原因引起的 学信网上的报告编号是什么 b类火灾是指什么
什么是粒子植入治疗 一热就咳嗽是什么原因 纵隔是什么意思 肚子疼吃什么药好 众望所归是什么意思
彩云之南是什么意思hcv8jop4ns1r.cn 相敬如宾什么意思hcv9jop2ns0r.cn 前胸后背疼是什么原因hcv9jop4ns8r.cn 大姨妈每个月提前来是什么原因hcv7jop5ns0r.cn 跳空缺口是什么意思hcv9jop7ns2r.cn
甜茶为什么叫甜茶hcv8jop9ns0r.cn 芋圆是用什么做的hcv9jop5ns0r.cn 女人脚浮肿是什么原因hcv8jop2ns5r.cn 物有所值是什么意思hcv8jop7ns6r.cn 前列腺炎有些什么症状shenchushe.com
少一颗牙齿有什么影响hcv8jop6ns7r.cn 左眼皮跳是什么预兆呢weuuu.com 全脂奶粉是什么意思baiqunet.com 全身瘙痒要警惕什么病hcv8jop4ns2r.cn 开屏是什么意思hcv9jop5ns1r.cn
固体饮料是什么意思hcv9jop6ns7r.cn 畏手畏脚是什么意思hcv7jop7ns4r.cn 后天是什么日子hcv8jop5ns2r.cn 阴虚和阳虚有什么区别的症状hcv8jop9ns5r.cn 青豆是什么豆hcv7jop4ns8r.cn
百度