Building Error with KToolbar

Started by
11 comments, last by Greig Hamilton 18 years, 1 month ago
http://www.gamedev.net/reference/programming/features/j2me1/page2.asp I've been following this tutorial, and up to page 3 I've been alright. But when I get up to the bit where I have to build a 'Basic MIDlet' I get given the error: javac: target release 1.1. conflicts with default source release 1.5 com.sun.kvem.ktools.ExecutionException Build failed I did a Google for that error and found a post on another forum where a guy encountered the exact same error and fixed it by downgrading his jdk (I'm not sure if I'm allowed to post links here). Do I have to downgrade my jdk to fix this problem or is there another way? Any help would be appreciated greatly.
Advertisement
You don't have to downgrade your jdk. There is an option to force java to compile the code so that the target is 1.1.

When you compile the code from the command line you need to use the -source and -target flags to force the code to be compiled as 1.1. Have a look in the java docs to find out which one you need. I think you only need one of them.



I have been building it with KToolbar up to this point in time.

How would I run it from a command prompt?

Also, what causes this sort of error?
Dude, 1.1. is ancient. I understand J2ME hasn't caught up with the new stuff (and honestly it's not so useful for mobile programming anyway), but AFAIK 1.4.2 is considered pretty standard for this stuff...

Anyway, to package stuff from the command line, you would run 'javac' as usual, and then 'jar' and 'preverify' - check your docs for more info.
The following link may be useful to explain it better.
http://java.sun.com/j2me/docs/alt-html/WTK104_UG/ch_cline.html#wp26484

Note – If you are using the compiler included with the Java 2 SDK, Standard Edition 1.4, use the -target 1.1 option when compiling your source files. If you do not do this, you will have problems preverifying your compiled classes.

I believe the problem is the specification for mobile phones is that they only need to support Java 1.1, this means that since the phones only support version 1.1 you can only create code that will run on 1.1. This is why you need to set the target to 1.1.

To use the command line for J2ME have a read of the KToolbar manual. I'm still not 100% sure why you are having the problem though since I can compile my files fine from KToolbar and I have Java 1.5 as my JDK.

Hopefully this is a bit clearer.

Greig
I typed the following code into the command prompt:
javac -d tmpclasses -bootclasspath C:\WTK104\lib\midpapi.z
ip -classpath tmpclasses;classes src\*.java -target 1.1


And was given the error:
javac: target release 1.1 conflicts with default source release 1.5

Thats the same error KToolbar gives me :-P

[Edited by - ShadowSyntax on March 11, 2006 8:26:25 PM]
Edited the above post with my current problem.
Try adding -source 1.4 or -source 1.2 to the command line. This will make the compiler assume that the code is not using any Java 1.5 features.

Greig

Edit: I just noticed that you are running WTK1.04 (based on your directory name), there is a much newer version out 2.2. This probably won't fix your issue but just thought you might want to know.
Ok I'll try updating...

Also, once i preverify it, how do I run it?
The newest version I can find is J2ME Wireless Toolkit 1.0.4_02 for Windows at http://java.sun.com/products/sjwtoolkit/download.html

EDIT: Nevermind, found it at a different link.

This topic is closed to new replies.

Advertisement