我正在VSCode中设置 Java ,但似乎无法正确获取 JRE。有人可以借一双眼睛指出我所缺少的吗?
我看到 2 个错误:
操作系统:Windows 10
安装的 Java 版本:JDK 11(版本 11.0.2)
环境变量:
JAVA_HOME> C:\Program Files\Java\jdk-11.0.12
MAVEN_HOME> C:\Program Files\apache-maven-3.8.2
路径>%MAVEN_HOME%\bin
聚甲醛:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sqa.tan</groupId>
<artifactId>automation</artifactId>
<version>1.0-SNAPSHOT</version>
<name>automation</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.5.1</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-gmail</artifactId>
<version>v1-rev20200919-1.31.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId> …Run Code Online (Sandbox Code Playgroud) 我最近一直在使用GDB来调试C++程序。对于标准用法,我通常这样做:
$ cd compiledir
$ compilescript
$ gdb compiled.out
$ run inputfile
Run Code Online (Sandbox Code Playgroud)
compilescript是一个程序,用于编译我正在开发的特定软件的代码,并且仅适用于Compiledir。它读取外部文件以获取编译器标志。对于 gdb,我包括了必要的-g标志。这适合我通过文本界面进行调试。然而,与 IDE 相比,这个文本界面使用起来越来越令人沮丧,而且我知道 Visual Studio 默认使用 gdb 作为后端来调试 C++ 文件。
首先,我让 Visual Studio 生成默认的 C++ 调试配置并尝试更改命令,但我不知道它在做什么,并且似乎没有太多关于制作自定义构建/调试配置的文档,特别是对于VScode 的 Linux 版本。
目前我有:
launch.json(默认)
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch", …Run Code Online (Sandbox Code Playgroud) 每次我在 vscode 上运行 python 文件时(在本例中,我按“在终端中运行 python 文件”按钮),终端始终以 Powershell 形式打开。
我选择的默认配置文件设置是命令提示符。所以当我打开一个新终端时,它会使用 cmd 打开。但是,当我运行 python 文件时,即使 cmd 终端已打开,也会启动一个新的 powershell 终端。我不知道为什么...
我如何解决它 ?
我在 VS Code 中调试 Azure Functions 项目时遇到困难。我使用 func init 创建了一个天蓝色项目。当我从运行菜单中单击“调试”时,项目会生成,但在尝试运行“func host start”时,会出现以下错误:
> Executing task: func host start <
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or opera
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -Command func host start
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Command:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException …Run Code Online (Sandbox Code Playgroud) 我发现在 VSCode 中编写 React 代码时使用自关闭标签更容易。默认的 Emmet 自动完成行为是插入显式的结束标记,例如。<Recipe></Recipe>,而我想要一种自动完成功能来发出自关闭标签的方法,例如。<Recipe />。
我以前制作过代码片段,但我不知道如何使代码片段前缀作用于更通用的输入。它需要对任何大写字母单词做出反应。我将如何创建一个片段来完成此任务?
我有一个带有多行注释的 Java 文件,如下所示:
/**
* original: 0, 2, 1, 4, 3, 5, 7, 6
* max: 0, 2, 2, 4, 4, 5, 7, 7
* sorted: 0, 1, 2, 3, 4, 5, 6, 7
* index: 0, 1, 2, 3, 4, 5, 6, 7
*
* The chunks are: 0 | 2, 1 | 4, 3 | 5 | 7, 6
* @param arr
* @return
*/
Run Code Online (Sandbox Code Playgroud)
当我格式化源代码时,它会格式化注释,如下所示:
/**
* original: 0, 2, 1, 4, 3, 5, 7, 6 max: …Run Code Online (Sandbox Code Playgroud) 我按照以下步骤在 wsl 上安装了 nodejs:
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl
然后调试 helloworld 示例,如下所示: https: //code.visualstudio.com/docs/nodejs/nodejs-tutorial#_debugging-your-node-application
所以我只是helloworld.js在 vscode 工作区目录的根目录下包含以下文件:
var msg = 'Hello World';
console.log(msg);
Run Code Online (Sandbox Code Playgroud)
有断点console.log
然后在调试选项卡上单击“创建 launch.json 文件”,这给了我默认配置:
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/helloworld.js"
}
Run Code Online (Sandbox Code Playgroud)
但是,当我按下F5活动栏调试按钮时,会出现一个*blip*,但没有任何反应,并且任何选项卡上都没有出现错误消息(集成终端、调试控制台、问题、输出)
仅当我通过添加到配置来指定 vscode 从何处获取节点二进制路径时:
"runtimeExecutable": "/home/user01/.nvm/versions/node/v14.18.0/bin/node"
Run Code Online (Sandbox Code Playgroud)
然后我开始运行我的代码并遵守我的断点。
我认为这可能是 vscode 无法在非交互式 shell 中找到路径的问题,所以我尝试按照此处找到的方式创建一个/etc/profile.d/nvm-autoload.sh具有以下内容的路径:
# Enable nvm if available
if [ -f ~/.nvm/nvm.sh ]; then
source ~/.nvm/nvm.sh
fi
Run Code Online (Sandbox Code Playgroud)
但还是没有...
如果我想调试打字稿文件,因为它需要runtimeExecutable …
debugging node.js visual-studio-code windows-subsystem-for-linux