Exception in thread “main” java.lang.NoClassDefFoundError: wrong name

后端 未结 3 1953
情话喂你
情话喂你 2020-12-15 05:21

My file directory:

project/src/m2mcom/entities/AutomatedTelnetClient.java
           /web/Simple.java           
           /org/apache/commons/net/telnet/Te         


        
3条回答
  •  半阙折子戏
    2020-12-15 06:09

    You're executing the command in the wrong folder, with the wrong classname. You need to use the fully qualified name (FQN) when running a Java class. And of course, you have to be in the right directory. In your example, the FQN of your class is m2mcom.web.Simple (combination of the package m2mcom.web and the simple name Simple).

    As far as deducing the right directory, your classes are stored in a hierarchical folder structure, which basically starts in C:\Users\Victor\Desktop\project2\src.

    So to correctly execute your program, from C:\Users\Victor\Desktop\project2\src, do;

    java m2mcom.web.Simple
    

提交回复
热议问题