Go to file
xiayuqi 713f7787e7 Merge branch 'master' of https://gitee.com/openkylin/vscode-java-debug 2024-10-09 00:17:47 -07:00
.github Add a troubleshooting guide for encoding issues (#1075) 2021-11-17 10:15:48 +08:00
.vscode Fix problemMatcher patterns for the watch task (#1137) 2022-03-16 10:01:16 +08:00
images Add debug/toolbar button to reload changed classes (#586) 2019-05-28 10:42:32 +08:00
scripts/build Up version to 0.39.0 & prepare pre-release script (#1144) 2022-03-28 15:42:18 +08:00
src 检测与开源插件是否冲突。冲突提示卸载开源文件 2024-08-29 15:53:21 +08:00
test update to @vscode/test-electron (#1189) 2022-07-08 12:56:16 +08:00
.editorconfig Enable GitHub Actions (#951) 2021-03-02 16:35:30 +08:00
.gitignore Add play/debug buttons to editor title bar for single file debugging (#856) 2020-07-31 14:59:05 +08:00
.vscodeignore Remove gulp dependencies (#1057) 2021-09-27 10:59:00 +08:00
CHANGELOG.md Change package.json,LICENSE,logo.png 2024-09-12 17:10:47 +08:00
CONTRIBUTING.md Prepare release for 0.38.0 (#1115) 2022-01-24 14:05:53 +08:00
Configuration.md Update the descriptions of the launch configs in README (#1176) 2022-06-07 13:30:15 +08:00
LICENSE.txt Change package.json,LICENSE,logo.png 2024-09-12 17:10:47 +08:00
README.md 修改readme 2024-10-08 00:18:25 -07:00
ThirdPartyNotices.txt Add ThirdPartyNotices (#1064) 2021-10-19 10:54:15 +08:00
Troubleshooting.md fix artifactId typo in Troubleshooting.md (#1180) 2022-06-28 21:53:06 +08:00
Troubleshooting_encoding.md Update Troubleshooting_encoding.md (#1082) 2021-11-22 19:50:17 +08:00
depends.json 1、删除openjdk依赖,使用java的openjdk依赖 2023-12-05 18:00:40 +08:00
java-debug.png Change package.json,LICENSE,logo.png 2024-09-12 17:10:47 +08:00
ori-LICENSE.txt Change package.json,LICENSE,logo.png 2024-09-12 17:10:47 +08:00
package-lock.json 1、更新Readme 2023-09-04 14:00:58 +08:00
package.json 修改描述 2024-10-09 00:17:39 -07:00
package.nls.es.json Remove existing encoding workarounds from client side (#1077) 2021-11-19 15:32:43 +08:00
package.nls.it.json Add debug/toolbar button to reload changed classes (#586) 2019-05-28 10:42:32 +08:00
package.nls.json Add a setting to control whether to enable async jdwp (#1208) 2022-08-31 12:16:45 +08:00
package.nls.zh-cn.json Add a setting to control whether to enable async jdwp (#1208) 2022-08-31 12:16:45 +08:00
package.nls.zh-tw.json Add zh-tw locale (#1087) 2021-12-20 14:16:11 +08:00
tsconfig.json Enable strict null checks in tsconfig (#918) 2020-12-08 16:23:13 +08:00
tslint.json Use InlineValuesProvider to provide inline debugging feature (#977) 2021-04-21 13:24:13 +08:00
webpack.config.js Fix problemMatcher patterns for the watch task (#1137) 2022-03-16 10:01:16 +08:00

README.md

中文|English

中文描述

概述

这是一个基于 Java Debug Server 的轻量级 Java 调试器,它扩展了 Red Hat 的 Java 语言支持。它允许用户使用 IDE调试 Java 代码。以下是其功能列表:

  1. 支持 Java 8 和 11。
  2. 支持远程调试。
  3. 支持断点、单步执行、查看变量等基本调试功能。
  4. 支持查看类路径、类加载器、方法栈等信息。
  5. 支持查看本地变量、局部变量、实例变量、静态变量等信息。
  6. 支持查看方法参数、返回值
  • 启动/附加
  • 断点/条件断点/日志点
  • 异常
  • 暂停与继续
  • 单步进入/退出/覆盖
  • 变量
  • 调用栈
  • 线程
  • 调试控制台
  • 评估
  • 热代码替换

要求

安装

打开IDE按下F1键或同时按下CtrlShift键再按P键打开命令面板选择“安装扩展程序”然后输入“kylinideteam.vscode-java-debug”。

或者按下“Ctrl + P”启动IDE Quick Open粘贴以下命令然后按回车键。

ext install kylinideteam.vscode-java-debug

使用方法:

  1. 将本插件安装到您的网站中。
  2. 创建一个新页面并将以下代码添加到该页面的HTML代码中
<script src="path/to/plugin/script.js"></script>

其中,path/to/plugin 是插件文件的路径。 3. 在该页面上添加一个表单,并添加一个文本输入框和一个提交按钮。 4. 将以下代码添加到表单的JavaScript代码中

const form = document.querySelector('form')
const input = document.querySelector('input[type="text"]')
const submitButton = document.querySelector('button')

form.addEventListener('submit' function(event) {
  event.preventDefault()
  const value = input.value
  const response = fetch(`https//api.example.com/endpoint` {
    method 'POST'
    headers {
      'Content-Type' 'application/json'
    }
    body: JSON.stringify({
      name: value
    })
  })

  response.then(function(response) {
    const data = response.json()
    if (data.success) {
      alert('Success ' + data.message)
    } else {
      alert('Error ' + data.message)
    }
  })
})
  1. https//api.example.com/endpoint 替换为您的 API 的 URL。
  2. 运行页面,输入一些文本,然后单击提交按钮。您的文本将被发送到您的 API并且您将在页面上收到成功或错误消息。
  • 启动IDE
  • 打开Java项目Maven/Gradle/Eclipse/单个Java文件
  • 打开Java文件以激活扩展程序
  • 按下F5

如果您在设置项目时遇到困难,请检查 Java语言支持 的文档。

选项

发布

  • mainClass - 包含主方法的类的完全限定名称。如果不指定,调试器将自动从当前项目中解析可能的主类。
  • ${file} - 当前Java文件。
  • com.mypackage.Main - 完全限定类名。
  • com.java9.mymodule/com.mypackage.Main - 完全限定模块名和类名。
  • /path/to/Main.java - 主类的文件路径。
  • args - 传递给程序的命令行参数。
  • "${command:SpecifyProgramArgs}" - 提示用户输入程序参数。
  • 一个用空格分隔的字符串或数组字符串。
  • sourcePaths - 程序的额外源代码目录。默认情况下,调试器从项目设置中查找源代码。此选项允许调试器在额外目录中查找源代码。
  • modulePaths - 启动JVM的模块路径。如果不指定调试器将自动从当前项目中解析。如果指定多个值调试器将将它们合并。
  • $Auto - 自动解析当前项目的模块路径。
  • $Runtime - 处于当前项目的“运行时”范围中的模块路径。- $Test - 项目当前 test 范围内的模块路径。
  • /path/to/exclude - 排除指定路径的模块路径。
  • /path/to/append - 将指定路径附加到模块路径中。
  • classPaths - 启动 JVM 的类路径。如果不指定,调试器将自动从当前项目中解析。如果指定多个值,调试器将将它们合并在一起。
  • $Auto - 自动解析当前项目的类路径。
  • $Runtime - 项目当前 runtime 范围内的类路径。
  • $Test - 项目当前 test 范围内的类路径。
  • /path/to/exclude - 排除指定路径的类路径。
  • /path/to/append - 将指定路径附加到类路径中。
  • encoding - JVM 的 file.encoding 设置。可能的值可以在 https//docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html 中找到。
  • vmArgs - JVM 的额外选项和系统属性(例如 -Xms<size> -Xmx<size> -D<name>=<value>),它接受一个字符串或字符串数组。
  • projectName - 调试器在类中搜索的首选项目。可能在不同的项目中存在重复的类名。当启动程序时此设置也会在调试器查找指定的主类时起作用。当工作空间包含多个Java项目时此设置是必需的否则表达式求值和条件断点可能无法正常工作。
  • cwd - 程序的工作目录。默认值为 ${workspaceFolder}.
  • env - 程序的额外环境变量。
  • envFile - 包含环境变量定义的文件的绝对路径。
  • stopOnEntry - 程序启动后自动暂停。
  • console - 要启动程序的指定控制台。如果不指定,则使用由java.debug.settings.console用户设置指定的控制台。
  • internalConsole - IDE调试控制台不支持输入流
  • integratedTerminal - IDE集成终端。
  • externalConsole - 外部控制台。

Englishdescription

Debugger for Java

Modified based on the version 0.46 of vscode-java-debug

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 IDE. 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 IDE and press F1 or Ctrl + Shift + P to open command palette, select Install Extension and type kylinideteam.vscode-java-debug.

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

ext install kylinideteam.vscode-java-debug

Use

  • Launch IDE
  • Open a Java project (Maven/Gradle/Eclipse/Single Java file)
  • Open a Java file to activate the extensions
  • Press F5

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

Options

Launch

  • mainClass - The fully qualified name of the class containing the main method. If not specified, the debugger automatically resolves the possible main class from current project.
    • ${file} - Current Java file.
    • com.mypackage.Main - The fully qualified class name.
    • com.java9.mymodule/com.mypackage.Main - The fully qualified module name and class name.
    • /path/to/Main.java - The file path of the main class.
  • args - The command line arguments passed to the program.
    • "${command:SpecifyProgramArgs}" - Prompt user for program arguments.
    • A space-separated 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. If multiple values are specified, the debugger will merge them together.
    • $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. If multiple values are specified, the debugger will merge them together.
    • $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. Possible values can be found in https://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.
  • 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 - IDE debug console (input stream not supported).
    • integratedTerminal - IDE 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.
      • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
      • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
      • java.* - Skip the specified classes. Wildcard is supported.
      • java.lang.ClassLoader - Skip the classloaders.
    • skipSynthetics - Skip synthetic methods when stepping.
    • skipStaticInitializers - Skip static initializer methods when stepping.
    • skipConstructors - Skip constructor methods when stepping.

Attach

  • hostName (required, unless using processId) - The host name or IP address of remote debuggee.
  • port (required, unless using processId) - 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 - 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 - [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.
      • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
      • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
      • java.* - Skip the specified classes. Wildcard is supported.
      • java.lang.ClassLoader - Skip the classloaders.
    • 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 IDE, 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 false.
  • java.debug.settings.showQualifiedNames: show fully qualified class names in "Variables" viewlet, defaults to false.
  • java.debug.settings.showLogicalStructure: show the logical structure for the Collection and Map classes in "Variables" viewlet, defaults to true.
  • java.debug.settings.showToString: show 'toString()' value for all classes that override 'toString' method in "Variables" viewlet, defaults to true.
  • 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.numericPrecision: the precision when formatting doubles in "Variables" or "Debug Console" viewlet.
  • java.debug.settings.hotCodeReplace: Reload the changed Java classes during debugging, defaults to manual. Make sure java.autobuild.enabled is not disabled for VSCode Java.
    • manual - Click the toolbar to apply the changes.
    • auto - Automatically apply the changes after compilation.
    • never - Never apply the changes.
  • 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.
  • java.debug.settings.onBuildFailureProceed: Force to proceed when build fails, defaults to false.
  • java.debug.settings.console: The specified console to launch Java program, defaults to integratedTerminal. If you want to customize the console for a specific debug session, please modify the 'console' config in launch.json.
    • internalConsole - IDE debug console (input stream not supported).
    • integratedTerminal - IDE 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.
    • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
    • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
    • java.* - Skip the specified classes. Wildcard is supported.
    • java.lang.ClassLoader - Skip the classloaders.
  • java.debug.settings.stepping.skipClasses: Skip the specified classes when stepping.
    • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
    • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
    • java.* - Skip the specified classes. Wildcard is supported.
    • java.lang.ClassLoader - Skip the classloaders.
  • 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.jdwp.async: Experimental: Controls whether the debugger is allowed to send JDWP commands asynchronously. Async mode can improve remote debugging response speed on high-latency networks. Defaults to auto, and automatically enable async mode in IDE - Insiders.
    • auto (Default)
    • on
    • off
  • java.debug.settings.vmArgs: The default VM arguments to launch the Java program. Eg. Use '-Xmx1G -ea' to increase the heap size to 1GB and enable assertions. If you want to customize the VM arguments for a specific debug session, please 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.

Pro Tip: The documentation Configuration.md provides lots of samples to demonstrate how to use these debug configurations, recommend to take a look.

Contributing

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute.

Feedback and Questions

You can find the full list of issues at Issue Tracker.

License

This extension is licensed under MIT License.