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(T开发者_StackOverflowM) 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?
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.
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)
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:
- rewrite a CharSequence class
- use java 1.4
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
精彩评论