Finally I built it up using CLDC 1.0 with MIDP 2.0, compiling is OK, preverify is OK, then I jared it, the book 'Learning Wireless Java' said make a manifest file as well, I don't know what do I need for a manifest file, so i ignored it, then I made a jad file, but when I run it(emulator), it told me something is missing: MIDlet-Name, in the manifest file, so I add it, then 'MIDlet-Vendor', 'MIDlet-Version', 'MIDlet-Configuration', 'MIDlet-Profile', for 'MIDlet-Configuration', i wrote 'CLDC-1.0', for 'MIDlet-Profile', i wrote 'MIDP-2.0', but when I emulate it, the phone appeared on my screen, and I could choose the app, but when I 'launch' it, I got a long long list of code (i think it's byte code) in the command line window, there's a line said "Warning: java.lang.ClassFormatError: Bad Version Information.", I suppose there's a text 'Hello, world!' on the phone's screen, but... so what's wrong? [ December 01, 2004: Message edited by: HaoZhe XU ]
[SCJP 1.2, SCJD, SCWCD]
Joined: Nov 03, 2003
I found this from API:
ClassFormatError: Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file
I have no idea how difficult it is for you to use the WTK 2.1... It's very very easy to use that... You just need to create a project, then WTK will ask you what versions of CLDC and MIDP you will use... Do according to the instructions from WTK...
You can even try to run the examples coming with WTK... Just open an existing project, build and run... That's it!
I agree with Ko Ko. Write a very simple "Hello, World" example and build it with WTK and WTK will compile, preverify, create JAD file as well as MANIFEST file automatically. After bulding the application, have a look inside the files created and I believe you will have a better understanding!
If you use the WTK, then it creates a default JAD file for you. If you are doing it by hand, then you have to create a JAD file, which is a simple properties file. There are some mandatory attributes that are needed for a JAD file.
Have a look at the JTWI specification or the CLDC/MIDP specs and they will list all the attributes that are necessary.
Just make sure you have them on the JAD file and everything should work fine.