如何解决 ClassNotFoundException? [英] How do I resolve ClassNotFoundException?
问题描述
我正在尝试运行 Java 应用程序,但收到此错误:
I am trying to run a Java application, but getting this error:
java.lang.ClassNotFoundException:
冒号后面是缺少的类的位置.但是,我知道该位置不存在,因为该类位于其他地方.如何更新该类的路径?和类路径有关系吗?
After the colon comes the location of the class that is missing. However, I know that that location does not exist since the class is located elsewhere. How can I update the path of that class? Does it have something to do with the class path?
推荐答案
您的类路径已损坏(这是 Java 世界中一个非常的问题).
Your classpath is broken (which is a very common problem in the Java world).
根据您启动应用程序的方式,您需要修改 -cp
的参数、MANIFEST.MF 中的类路径条目或磁盘布局.
Depending on how you start your application, you need to revise the argument to -cp
, your Class-Path entry in MANIFEST.MF or your disk layout.
这篇关于如何解决 ClassNotFoundException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!