Java/lang/classformaterror:bad version Informationd How to modify Eclipse and JBuilder

Source: Internet
Author: User

This error often occurs in the development of J2ME.

Eclipse Modification Method:

Set the ' Java Compliance level ' to 1.4. For this, in the Eclipse go to Project-> Properties-> Java compiler, enable "Project specific Settings" and "Then set" Java Compliance level ' to 1.4.

It may actually be a stitch to a different environment, especially if you're debugging with someone else's program, and you just need to modify the JDK configuration, which is the JDK you're compiling and the JDK you're actually deploying.

JBuilder Modification Method:

Today learn to do J2ME development, according to the example of the book to write HelloWorld, and then run in Jbuilder2006, made several times is not see the effect, then see the running output only to find an error. , the error message is as follows:
Alert:java/lang/classformaterror:bad version information.

Rely on, has not begun to give a dismount, in Google checked, the original is Jbuilder2006 error, only need to modify the parameters in Project can be, specific as follows:

Project-> Project Properties->build->java Item
Put the default target Vm:java 2 SDK, v5.0 and later
Change to all Java SDKs

Then it is important that you rebuild your project (this step is very important),

It's OK.

Write a separate article:

Just pretend Jbuilder2006 soon, today is going to test with the Sun Mobile development package WTK2.2, so a new project, select wtk2.2 Class Library, and then build MIDlet project. JBuilder automatically generated code, I refer to some data to rewrite it into a HelloWorld program, and then run the test, the results found that the phone simulator pop-up, the program appears, click to start immediately after automatic shutdown, while the console inside a large stack of data. True, try many times, and then carefully check the output of the console, a line of red words caught my attention:

ALERT Java/lang/classformaterror:bad Version Information

This is a very confusing tip (Java development often encountered a lot of errors thrown, look very depressing ...) ), "corrupted version information." It's strange. So I rebuilt the project, not to make any changes to the automatically generated code, try again, the result is the same. Is there something wrong with my jbuilder file? Simply reload it and try it. The depressing thing is, after reloading, the problem remains the same ...

Then inadvertently found the problem in JBuilder's readme.html document: Originally this is a known problem: The original text is as follows:

[227771] If you use WTK 2.2 and earlier, and the ' message ' Alert:java/lang/classformaterror:bad version Informati On ' When you launch the MIDlet, your may need to set the target VM in JBuilder to any targets other than Java 2 SDK, v 5.0 (generics enabled). This option is on the build| Java page of the Project Properties dialog box.
The effect is that if you use wtk2.2 or later, and you encounter the "Alert:java/lang/classformaterror:bad version information" error message when you run MIDlet, You may need to set the target virtual machine (VM) in JBuilder to include options other than the Java 2 SDK v5.0 (generics enabled). This option is in the project's property->build->java entry.

According to the article, after rebuild project, rerun the program, finally normal, mobile phone simulator screen appeared hello World text. Success.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.