简体   繁体   中英

difference between command line option -cp and -classpath?

I am not able to run a Apple.class file without specifying command line cp option. I have a Apple.class file in my E:\\ directory. but when I run E:\\java Apple, It show me error on command prompt like "Could not load or find a main method" .

what is the difference between -cp and -classpath ?

-cp and -classpath are the same option. You just need to specify the fully-qualified name (eg com.mypackage.Apple ) and also include all the required classes/jars + the main class into the classpath.

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