简体   繁体   English

错误:找不到或加载主类。 Powershell / Java

[英]Error: Could not find or load main class. Powershell/Java

I just started Java. 我刚刚启动Java。 I was initially using NetBeans to code and it works. 我最初使用NetBeans进行编码,并且可以正常工作。 But my teacher is insisting that we use a text editor and run it through Powershell. 但是我的老师坚持要求我们使用文本编辑器并通过Powershell运行它。 I'm getting a "Could not find or load main class" error with this code. 我收到此代码的“找不到或加载主类”错误。

public class a10{
    public static void main(String[] args){
        System.out.println("Hello World");
    }
}

When I run it on Netbeans, there are no errors, but I'm unable to run it on Powershell. 当我在Netbeans上运行它时,没有错误,但是我无法在Powershell上运行它。 Can someone tell me what's wrong and how I would fix it 有人可以告诉我哪里出了问题以及如何解决

I hope you are compiling the class using 我希望您使用

javac a10.java and then running it by java a10 --- Is it so javac a10.java然后通过java a10运行它---是这样吗

Look at this post for more info 查看此帖子以获取更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM