I wrote a simple hello world program to test the JDK installation. I can compile from Vim using:
:!javac Desktop\HelloWorld.java
That works just fine but when I try to run the program using:
:!java Desktop\HelloWorld
it gives me this error:
C:\Windows\system32\cmd.exe /c java "Desktop\HelloWorld" Exception in thread "main" java.lang.NoClassDefFoundError: Desktop\HelloWorld (w rong name: HelloWorld) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: Desktop\HelloWorld. Program will exit.
The program works just fine from the normal command line.
C:\Users\Casey\Desktop>java HelloWorld
Hello world!
How can I execute the program from Vim without having to switch to the standard cmd?