关于java版本1.3到1.4
我正在使用这个Java版本:
java 版本“1.3.1_01”Java(TM) 2 运行时环境,标准版(版本 1.3.1_01)Java HotSpot(TM) 客户端 VM(版本 1.3.1_01,混合模式)`
但是我已经编写了一个应用程序,我得到了运行时错误
Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/CharSequence
CharSequence
仅自 1.4 起存在。
我怎样才能克服这个问题?
I am using this Java version:
java version "1.3.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01) Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)`
But I have written an application and I am getting run time error
Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/CharSequence
CharSequence
only exists since 1.4.
How can I overcome this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来您有一些 1.4 代码试图在 1.3 上运行。
你犯了一个典型的错误,即假设你的假设是正确的。检查你的假设。
这两个 JVM 的支持寿命都已结束。也许你应该考虑升级。 JDK 6 是当前标准。
Sounds like you have some 1.4 code that you're trying to run on 1.3.
You're making the classic mistake of assuming that your assumptions are correct. Check your assumptions.
Both JVMs are well past the end of their support lives. Perhaps you should consider upgrading. JDK 6 is the current standard.
您必须编写代码(并编译)针对比您尝试运行代码更高版本的 JDK/JRE。如果您必须坚持在 1.3 上运行,请确保您也针对 1.3 进行构建。
另一种选择是您使用针对更高版本的 JDK 构建的第 3 方 JAR。在这种情况下,请找出导致问题的库并停止使用它。
或者,如果可能的话,将您的整个环境升级到 1.6(或 1.5,如果这对您来说太现代)
You must have either written your code (and compiled it) against a later version of the JDK/JRE than you are trying to run it on. If you must stick with running on 1.3, make sure you are building against 1.3 as well.
The other option is that you are using a 3rd-party JAR which was built against a later version of the JDK. In which case, figure out which library is causing the problem and stop using it.
Or, if possible upgrade your whole environment to 1.6 (or 1.5, if this is too modern for you)
根据JavaDocs,CharSequence接口是由CharBuffer、String和StringBuffer实现的。鉴于这些类如此深入地嵌入到一切事物中,我无法想象如何解决这个问题。所以有两个解决方案:
According to the JavaDocs, the CharSequence interface is implemented by CharBuffer, String and StringBuffer. Given that these classes are so deeply embedded in everything, I can't imagine how you can get around the problem. So two solutions:
如果适合您的需要,请尝试使用 String 而不是 CharSequence。否则 char[] 可能会有用。这取决于。显示您的代码以进行更具建设性的对话
Just try to use String instead of CharSequence if it suites you needs. Otherwise may be char[] will be useful. It depends. Show your code to have more constructive conversation