Sign in to follow this  
ShadowSyntax

Building Error with KToolbar

Recommended Posts

ShadowSyntax    122
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.

Share this post


Link to post
Share on other sites
Greig Hamilton    181
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.



Share this post


Link to post
Share on other sites
Zahlman    1682
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.

Share this post


Link to post
Share on other sites
Greig Hamilton    181
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

Share this post


Link to post
Share on other sites
ShadowSyntax    122
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]

Share this post


Link to post
Share on other sites
Greig Hamilton    181
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.

Share this post


Link to post
Share on other sites
ShadowSyntax    122
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.

Share this post


Link to post
Share on other sites
Greig Hamilton    181
From within KToolbar you can load your project then there is an icon called "run program" or similar, this should open the default emulator with your program running. You can also download emulators for Nokia, Sony Ericsson etc from their websites.

Greig

Share this post


Link to post
Share on other sites
Greig Hamilton    181
Have a look in wtk104\bin there should be an exe file called preverify. If you just type that in it should display some help information.

I really recommend that you read the manual that comes with the WTK. It has a lot of useful information in it that will answer your questions. For example if you open up the manual and refer to Appendix B - Command Line Reference, then you will find out how to preverify from the command line.

Greig

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this