简体   繁体   English

我无法在 Visual Studio Code 上运行 Java! 我尝试了很多

[英]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.

相关问题 如何在Visual Studio Code中找到Java的类路径? - How can I find classpath for Java in Visual Studio Code? 为什么这个java代码没有运行类并打印值? 我尝试了很多但找不到出路 - Why is this java code not running the class and printing the values? I have tried a lot but not able to find a way out 如何禁用运行 | Visual Studio 代码中 java 主 class 文件中的调试选项 - How do i disable Run | Debug option coming in java main class file in Visual Studio code 如何转到 Visual Studio Code 的 Java 调试控制台中的错误行代码 - How can I go to the error line code in Visual Studio Code's Java Debug Console 我试图更新我的jdk,但没有解决(Visual Studio代码)1.38版本 - i tried to update my jdk but didn't fix it (Visual studio code) 1.38 version 我无法使用 java 测试运行器扩展在 Visual Studio 上测试我的 java 代码 - i can not test my java code on visual studio using the java test runner extension 无法在 Visual Studio Code 中运行 java 代码 - Not able to run java code in Visual Studio Code 如何在 Visual Studio 代码中创建 Java web 应用程序? [等候接听] - how I create a Java web application in visual studio code? [on hold] 我无法在 Visual Studio Code 上设置 JDK - I can't set up JDK on Visual Studio Code 如何在 Visual Studio 代码中导入包? - how can i import packages in visual studio code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM