need help with command line compiling midlet

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

need help with command line compiling midlet

Postby tlatoanimeshika » Sat Jan 19, 2008 8:43 pm

Hi i downloaded the wireless tool kit 2.5.2, my machine is very slow and takes too long to execute the program in addition i had compiled some small java programs with command line successfully in j2se with the command line, very simple and fast, well i was reading that this can be done too with the j2me plattform but doing it differently. I spent a day completely reading about the topic but im failing, im doing everything supposedly right, but i havent reached the aim of creating the class file. First, setting the path was so much painful and frustating, is there a way to set it permanently using the command line? I did it using the right click on mypc, and clicking on enviroment variables.

Well, going back to the main reason for posting, i have installed the wireless plattform this way
c:\wtk252\lib and i have a midlet in this directory c:\ChoiceGroupDemo.java, i have the java bin directory and the wireless toolkit bin directory set to path for using the javac command and preverify command respectively, the instructions i found on the net are a little old but are meaningful cause i found that even a batch file can be created for optimizing the process. The problem is that i dont know what classes should i use with the bootclasspath operator, in the example some ones used midpapi.zip others used classes.zip but i have no one of them instead i have in c:\wtk252\lib\midpapi10.jar, midpapi20.jar, and midpapi21.jar in addition to others

Well i did this on the command line
c:\javac -bootclasspath c:\wtk252\lib\midpapi10.jar ChoiceGroupDemo.java
and i get 6 errors: cannot access java.lang.string
cannot access java.lang.object
package system does not exist
cannot find symbol
"
"
i tried using the midpapi20.jar library and happened the same
i tried this
c:\javac -bootclasspath c:\wtk252\lib\*.jar ChoiceGroupDemo.java
and i got this: invalid flag :c:\wtk252\lib\cldcapi11.jar

I dont know if im misdirecting the bootclasspath operator to the right libraries, what do you thing guys, by the way , this is the small midlet im trying to compile: "ChoiceGroupDemo.java"

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class ChoiceGroupDemo extends MIDlet implements CommandListener {

private boolean boolMotion=false;
Display mDisplay;

Form frm;

ChoiceGroup cg;
Command cmd;

ChoiceGroupDemo() {
frm=new Form("Choice Group Demo");
cg=new ChoiceGroup("Choose Movie:",Choice.MULTIPLE);
cmd=new Command("OK",Command.OK,1);

cg.append("Horror",null);
cg.append("Comedy",null);
cg.append("Action",null);
frm.append(cg);
frm.setCommandListener(this);
}


public void commandAction(Command c, Displayable d) {

for(int i=0;i<3;i++) {
if(cg.isSelected(i)) {
System.out.println("u selected :" +
cg.getString(elementNum));

return;
}
}
}

public void startApp() {
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(frm);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional){}
}
tlatoanimeshika
 
Posts: 3
Joined: Sat Jan 19, 2008 7:22 pm

Re: need help with command line compiling midlet

Postby DevelopmentTeam » Sun Jan 20, 2008 5:02 am

I dont have much experience with command line compiling for j2me. Though its definitely possible, its bit complicated as you need to many packages for reference, like MIDP and CLDC packs etc. But WTK tool kit should be a simple app to run on slow machines..
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: need help with command line compiling midlet

Postby tlatoanimeshika » Tue Jan 22, 2008 10:24 pm

finally i could get the class file, i think i was misdirecting -bootclasspath, i got confused with the dos syntax, i was using it when it wasn't necessary. I created 3 variables with set command
set p1=c:\wtk2.5.2\lib\cldcapi10.jar
set p2=c:\wtk2.5.2\lib\midpapi10.jar
set prog=ChoiceGroupDemo
created 2 directories classes and tmpclasses
then compiled it with javac command
javac -bootclasspath %p1%;%p2% %prog%.java -d tmpclasses
then the ChoiceGroupDemo.class was created and send to tmpclasses directory
BUt now im having problems with preverifying the classes i did this
i set a new variable for the preverify command
set prev=c:\wtk2.5.2\bin\preverify.exe
then im trying to verify the classes with this prompt command
%prev% -classpath %p1%;%p2%;tmpclasses -d classes
and it just displays me the preverify command options as if something was missing.
Maybe im wrong with the syntax, ill try to solve it later.
Any idea?
tlatoanimeshika
 
Posts: 3
Joined: Sat Jan 19, 2008 7:22 pm

Re: need help with command line compiling midlet

Postby tlatoanimeshika » Wed Jan 30, 2008 8:55 pm

i just come to say im doomed, i failed astounding to get my midlet via command prompt, i did whatever i could do, i got it compiled, verified and jared it but it never ran, i used wtk wireless toolkit to make the process alternatively and got it all right, the weird thing here is that the wkt compiled the *.java file and created a *.class file of 680 bytes but when i compiled the same file via command prompt the resulting *.class file was huger in size 880 bytes. I realized that the problem was in the first step of all the cicle, the javac file was generating a incompatible file.Finally i found a site where they talk about this concern, i have the
sdk 1.6 version and supposedly wkt does not work well with it, i suppose is right because i found some bugs in the program like dont recognizing my mouse, i had to use another windows account to access it. In resume the tutorial says that i have to use the javac command but targeted to the 1.4 sdk version, well, i did it but it didnt work. The *.class file still follow being 880 bytes huge.

By the way does anybody know how to generate verbose output from the WTK wireless?
tlatoanimeshika
 
Posts: 3
Joined: Sat Jan 19, 2008 7:22 pm

Re: need help with command line compiling midlet

Postby DevelopmentTeam » Thu Jan 31, 2008 4:32 am

It seems to be much complected to work on command line now. Just imagine if we dont have netbeans project and WTK project, J2ME wouldn't have been this simple and famous. :)
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: need help with command line compiling midlet

Postby DevelopmentTeam » Thu Jan 31, 2008 4:34 am

But I still dont have a clue why tlatoanimeshika is trying it on command line, when his pc can run wtk, he can definitely it to compile. Anyway, all that WTK does internally is uses the commandline tool to do all the stuff in sequence. WTK itself doesn't consume a lot resource. :|
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron