且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误“未找到主要类别”

更新时间:2022-06-21 21:35:20

你在包里面。你应该坐在包根目录中。去一个文件夹。

You're inside the package. You should be sitting in the package root. Go one folder up.

cd ..

然后使用 java project.DriverClass 重新执行它。

也就是说,你不应该使用 CLASSPATH 环境变量。你的目前也是无效的。未加引号的路径名中有空格。此外, JDK / bin 文件夹不应该在类路径中。只需使用 -cp 参数,如 java -cp。 project.DriverClass (当坐在包根文件夹中时)。

That said, you should prefer not to use the CLASSPATH environment variable. Yours is currently also invalid. There are spaces in unquoted pathnames. Also, the JDK/bin folder isn't supposed to go in the classpath. Just use the -cp argument like java -cp . project.DriverClass (while sitting in the package root folder).