程序是这样的,我想运行C盘下的酷狗7,javac RunTimeDemo.java没报错然后 java RunTimeDemo异常
class RuntimeDemo
{
public static void main(String[] args)throws Exception
{
Runtime r = Runtime.getRuntime();
r.exec("C:\\Program Files\\KuGou7\\kugou7.exe");
}
}
但是出异常,我在网上查了,他们说可能是classpath设置问题,我看了我的设置的没错,运行例如java SystemDemo都能运行,就这个不行,
Exception in thread "main" java.lang.NoClassDefFoundError: RunTimeDemo (wrong na
me: RuntimeDemo)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:472)
|