简体   繁体   中英

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.

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

pause

where classes\\champ2009client folder is where the class file is located. In my laptop which have Win xp32 it works fine but in my pc i got could not find or load main class error. Is there possibility to got problems from windows 7??

Try to run your your program as below

java -classpath . your_class_that_has_main_method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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