How do I resolve ClassNotFoundException?

前端 未结 22 1943
后悔当初
后悔当初 2020-11-21 06:06

I am trying to run a Java application, but getting this error:

java.lang.ClassNotFoundException:

After the colon comes the location of the cla

22条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 06:39

    If you know the path of the class or the jar containing the class then add it to your classpath while running it. You can use the classpath as mentioned here:

    on Windows

    java -classpath .;yourjar.jar YourMainClass
    

    on UNIX/Linux

    java -classpath .:yourjar.jar YourMainClass
    

提交回复
热议问题