J2ME CLDC on linux with JDK 1.6.0

I downloaded the J2ME CLDC code i.e. j2me_cldc-1_1-fcs-src-winunix.zip

After unpacking the archive I tried a make :

paul@localhost:~/bin/j2me_cldc/build/linux$ make

It started OK before bailing out with lots of character encoding errors such as:

src/com/sun/cldc/util/j2me/CalendarImpl.java:2: warning: unmappable characterfor encoding ASCII

* Copyright ? 2003 Sun Microsystems, Inc. All rights reserved.

^

This seems to be due to the copyright symbol in the headers which isn't supported by ASCII. I got round this by specifying the encoding type in the j2me_cldc/api/Makefile, i.e. :

JAVAC= javac -encoding cp1252

So I tried make j2me again but this time get the following error:

src/java/lang/Object.java:132: cannot access java.lang.StringBuilder

class filefor java.lang.StringBuilder not found

return getClass().getName() +"@" + Integer.toHexString(hashCode());

^

1 error

make[1]: *** [compilefiles] Error 1

make[1]: Leaving directory `/home/paul/bin/j2me_cldc/api'

make: *** [all] Error 1

Now I don't know what to do next.

As per the subject title I'm trying to install this on a FC6 linux box with jdk-1.6.0.

Paul

[1440 byte] By [moulsonpa] at [2007-11-26 18:47:40]
# 1
try to compile your MIDlet with java 1.4 compliance because j2me doesn't know StringBuilders!
suparenoa at 2007-7-9 6:21:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Thanks for the tip supareno.

I added -target 1.4 -source 1.4

to the compile options and indeed it got a bit further; however I was next presented with a truck load of warnings before it finally abended:

../../../kvm/VmCommon/src/verifierUtil.c: In function 'matchStackMap':

../../../kvm/VmCommon/src/verifierUtil.c:426: warning: dereferencing type-punned pointer will break strict-aliasing rules

../../../kvm/VmCommon/src/verifierUtil.c: In function 'verifyClass':

../../../kvm/VmCommon/src/verifierUtil.c:547: error: invalid storage class for function 'Vfy_verifyMethod'

../../../kvm/VmCommon/src/verifierUtil.c:571: warning: implicit declaration of function 'Vfy_verifyMethod'

../../../kvm/VmCommon/src/verifierUtil.c:604: warning: dereferencing type-punned pointer will break strict-aliasing rules

../../../kvm/VmCommon/src/verifierUtil.c: At top level:

../../../kvm/VmCommon/src/verifierUtil.c:1595: error: static declaration of 'Vfy_verifyMethod' follows non-static declaration

../../../kvm/VmCommon/src/verifierUtil.c:571: error: previous implicit declaration of 'Vfy_verifyMethod' was here

../../../kvm/VmCommon/src/verifierUtil.c: In function 'Vfy_verifyMethod':

../../../kvm/VmCommon/src/verifierUtil.c:1598: error: invalid storage class for function 'Vfy_checkNewInstructions'

../../../kvm/VmCommon/src/verifierUtil.c:1609: warning: dereferencing type-punned pointer will break strict-aliasing rules

../../../kvm/VmCommon/src/verifierUtil.c:1610: warning: dereferencing type-punned pointer will break strict-aliasing rules

../../../kvm/VmCommon/src/verifierUtil.c:1616: warning: dereferencing type-punned pointer will break strict-aliasing rules

../../../kvm/VmCommon/src/verifierUtil.c:1633: warning: implicit declaration of function 'Vfy_checkNewInstructions'

../../../kvm/VmCommon/src/verifierUtil.c: At top level:

../../../kvm/VmCommon/src/verifierUtil.c:1671: error: conflicting types for 'Vfy_checkNewInstructions'

../../../kvm/VmCommon/src/verifierUtil.c:1633: error: previous implicit declaration of 'Vfy_checkNewInstructions' was here

make[1]: *** [obj/verifierUtil.o] Error 1

make[1]: Leaving directory `/home/paul/bin/j2me_cldc/kvm/VmUnix/build'

make: *** [all] Error 1

Any other suggestions?

moulsonpa at 2007-7-9 6:21:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
sorry no more suggestions ...
suparenoa at 2007-7-9 6:21:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

Hi all!

so, after you change your

JAVAC= javac

to

JAVAC= javac -encoding cp1252 -target 1.4 -source 1.4

in your Makefile:

grep "javac" `find . -name Makefile`

you must open:

j2me_cldc/kvm/VmCommon/src/verifierUtil.c

and change some line, like add at the beginning these two lines:

...

unsigned short vSP;

static bool_t Vfy_checkNewInstructions(METHOD vMethod);

static int Vfy_verifyMethod(METHOD vMethod);

#if INCLUDEDEBUGCODE

...

and comment that line:

...

/*=========================================================================

* FUNCTION:Vfy_verifyMethod

* TYPE: private operation

* OVERVIEW:Verify a method

*

* INTERFACE:

*parameters: vMethod: the method

*returns:Nothing

*=======================================================================*/

static int Vfy_verifyMethod(METHOD vMethod) {

void Vfy_verifyMethodOrAbort(const METHOD vMethod);

//static bool_t Vfy_checkNewInstructions(METHOD vMethod);

int res;

...

and that one:

/*=========================================================================

* FUNCTION:verifyClass

* TYPE: public operation on classes.

* OVERVIEW:Perform byte-code verification of a given class. Iterate

*through all methods.

*

* INTERFACE:

*parameters: thisClass: class to be verified.

*returns:0 if verification succeeds, error code if verification

*fails.

*=======================================================================*/

int verifyClass(INSTANCE_CLASS thisClass) {

//static int Vfy_verifyMethod(METHOD vMethod);

int i;

int result = 0;

#if USESTATIC

Hope this helps,

Denis

denis_pitzalisa at 2007-7-9 6:21:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
Indeed it does help. Thanks a lot. It builds with a load of warnings, but at least it does build.Cheers, Paul
moulsonpa at 2007-7-9 6:21:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...