首页 > 代码库 > Main方法中传入参数
Main方法中传入参数
↓
这个时候会报错:
Instantiate the class:DonutShop
java.lang.ClassNotFoundException: DonutShop
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at Shop.TestShop.main(TestShop.java:10)
Exception in thread "main" java.lang.NullPointerException
at Shop.TestShop.main(TestShop.java:15)
需要在参数里加上包名字: