I've developed some java code in the NetBeans IDE 4.1, it compiles and runs fine in NetBeans.
I want to try to run to same code via command line. I get this message:
Exception in thread "main" java.lang.NoClassDefFoundError: testproject/build/cla sses/testproject/testprog (wrong name: testproject/testprog) at java.lang.ClassLoader.defineClass0(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$100(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)
Pretty common issue on these forums, so I researched what people did to fix them. I checked my class path variables (both user and system), they are both: C:\Netbeans_projects\
The class file (testprog.class) is saved in this directory: C:\NetBeans_projects\TestProject\build\classes\testproject\
I go to the c:\NetBeans_projects directory and type: java testproject.build.classes.testproject.testprog
And I get the error above, I've also tried: java testproject/build/classes/testproject/testprog java testproject\build\classes\testproject\testprog
None of them work.
Also, I've tried to compile the java file (testprog.java), saved at: C:\NetBeans_projects\TestProject\src\testproject\ via command-line. It works, but saves the .class file in the src directory instead of the build directory. (But thats a separate issue)