[英]What i can't run a class file created Intellij Idea?
Have a simple programm: 有一个简单的程序:
package com.test;
public class Main {
public static void main(String[] args) {
System.out.println("lol");
}
}
In Intellij Idea project run correctly, but if i run out class file by cmd, like java Main.class
i have a Error 在Intellij Idea项目中可以正常运行,但是如果我用cmd耗尽了类文件,例如
java Main.class
我将遇到一个错误
Error: Could not find or load main class Main.class
If i compile .java
manually - i have some error. 如果我手动编译
.java
我有一些错误。
In $PATH path to .../jdk/bin
. 在$ PATH到
.../jdk/bin
路径中。 In Intellij Idea path to SDK .../jdk
. 在Intellij Idea的SDK
.../jdk
路径中。
What's the problem? 有什么问题?
Thanks! 谢谢!
Your class is not Main
, but com.test.Main
. 您的班级不是
Main
,而是com.test.Main
。 You should use: 您应该使用:
java com.test.Main
from the root directory of the compile output (ie, from the same place as the com/
folder) 从编译输出的根目录(即,与
com/
文件夹位于同一位置)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.