i know how to create a batch file that simply says "java Main.class" and it runs the java program fine on my machine, but only if it doesnt have a package statement. lets say my package statement is "com.javaranch" what EXACTLY would my batch file look like? i'm unfamiliar with dos commands. thanks much! kevin
Hi Kevin, Welcome to JavaRanch! Note that "java Main.class" isn't going to work; "java Main" is correct. If Main is in a package, you just need to say "java com.javaranch.Main". Both of these assume that Main.class, or com/javaranch/Main.class, are on your CLASSPATH.
hey thanks for the reply. i tried what you said, but this is the error i get at the DOS prompt: Exception in thread "main" java.lang.NoClassDefFoundError: edu/uwec/cs/schneidr/networkTest/Client but when i just compile and run the program in eclipse there are no problems at all. anyone know what i'm doing wrong? thanks again
try to use java -cp . Main, this means you add the actual path to your classpath. So edu should then be a subfolder of your actual directory. Then java should be able to find the required classes
Joined: Oct 16, 2003
well i've been doing all of this within a batch file...and i've been placing the batch file in the same dir as the actual class files. however i just moved the batch file to the root director (root of the package) and now it works perfectly. i guess thats where the problem was. thanks for all of the help guys.