[英]I can not run Java on Visual Studio Code! I tried a lot
My problem is that I can not run Java on Visual Studio Code.我的问题是我无法在 Visual Studio Code 上运行 Java。 I downloaded all extension and JDK but there is an issue and error when I run the code..
我下载了所有扩展和 JDK,但运行代码时出现问题和错误。
I took a screenshot for my problem.我为我的问题截取了屏幕截图。
here is the code:这是代码:
public class Hello {
public static void main(String[] args) {
System.out.println("hi");
}
}
here is the error in the terminal:这是终端中的错误:
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Ahmed\Desktop\LearnJava> & 'c:\Users\me\.vscode\extensions\vscjava.vscode-java-debug-0.26.0\scripts\launcher.bat' 'C:\Program Files\Java\jdk-13.0.2\bin\java.exe' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\me\AppData\Roaming\Code\User\workspaceStorage\869d91d9e4b3718bf03724a877036fed\redhat.java\jdt_ws\LearnJava_9276adca\bin' 'Hello'
ahl
PS C:\Users\me\Desktop\LearnJava>
here is the error in the output:这是 output 中的错误:
Running] cd "c:\Users\me\Desktop\LearnJava\" && javac Hello.java && java Hello
[Done] exited with code=0 in 4.348 seconds
[Running] cd "c:\Users\me\Desktop\LearnJava\" && javac Hello.java && java Hello
ahl
[Done] exited with code=0 in 1.152 seconds
[Running] cd "c:\Users\me\Desktop\LearnJava\" && javac Hello.java && java Hello
ahl
[Done] exited with code=0 in 1.236 seconds
[Running] cd "c:\Users\me\Desktop\LearnJava\" && javac Hello.java && java Hello
ahl
[Done] exited with code=0 in 1.157 seconds
From the outputs you give out, everything works well, partly.从你给出的输出来看,一切都运作良好,部分。 Both of debugger and code-runner.
调试器和代码运行器。 The only problem you run across is the outputs are not what you expected.
您遇到的唯一问题是输出不是您所期望的。 It's more like a cache problem, you can try to create a new.java file, or delete the cache folder: 'C:\Users\me\AppData\Roaming\Code\User\workspaceStorage\869d91d9e4b3718bf03724a877036fed'.
更像是缓存问题,可以尝试新建一个.java文件,或者删除缓存文件夹:'C:\Users\me\AppData\Roaming\Code\User\workspaceStorage\869d91d9e4b3718bf03724a877036fed'。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.