简体   繁体   English

找不到或加载主类

[英]Could not find or load the main class

I m trying to run a project from command prompt but i get "could not find or load the main class". 我试图从命令提示符下运行一个项目,但得到“找不到或加载主类”。 Firstly i compile the classes of the project which are located in src folder. 首先,我编译位于src文件夹中的项目类。

cd C:\\Program Files (x86)\\toc\\ENTRIES-champ\\entry\\src set path=%path%;C:\\Program Files\\Java\\jdk1.6.0_27\\bin javac -d ../classes champ2009client/*.java cd C:\\ Program Files(x86)\\ toc \\ ENTRIES-champ \\ entry \\ src set path =%path%; C:\\ Program Files \\ Java \\ jdk1.6.0_27 \\ bin javac -d ../classes champ2009client / *的.java

The above commands create the class files of the project. 上面的命令创建项目的类文件。 After that i try the above commands to run main class: 之后,我尝试上述命令运行主类:

cd C:\\Program Files (x86)\\toc\\ENTRIES-champ\\entry\\classes java champ2009client.Client champ2009client.driver cd C:\\ Program Files(x86)\\ toc \\ ENTRIES-champ \\ entry \\ classes java champ2009client.Client champ2009client.driver

pause 暂停

where classes\\champ2009client folder is where the class file is located. class \\ champ2009client文件夹是类文件所在的位置。 In my laptop which have Win xp32 it works fine but in my pc i got could not find or load main class error. 在装有Win xp32的笔记本电脑中,它可以正常工作,但在我的电脑中,我找不到或加载主类错误。 Is there possibility to got problems from windows 7?? 是否有可能从Windows 7出现问题?

Try to run your your program as below 尝试如下运行您的程序

java -classpath . java -classpath。 your_class_that_has_main_method your_class_that_has_main_method

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

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