This is one of those terribly embarrassing questions I'm afraid.
I have a program in Eclipse:
package ds;
public class DiServer {
public static void main(String[] args) {
int foo = 0;
int bar = 0;
/*bla*/
}
}
Simple right? This works completely fine when run in Eclipse.
I want to run this from command line. I have copied bin Folder, with the ds folder inside it and DiServer.class in ds, and .classpath
I have put these into a separate folder, C:My DocumentsDiTest, opened command prompt, gone to C:My DocumentsDiTestds and typed java DiServer
The error I get is Exception in thread "main" java.lang.NoClassDefFoundError: DiServer <wrong name:ds/DiServer> ... Could not find the main class: DiServer. Program will exit.
I have tried java -classpath . DiServer, java -classpath ../.. DiServer, moving .classpath to the ds folder, but I can't seem to get round this. I'm 99% sure it's a classpath problem but I can't work out how to fix it.
I would greatly appreciate any help as always, and the customary offer of a pint always stands.
Thanks very much in advance,
M
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…