Subject: sun-jdk15 and wireless toolkit v2.2
To: None <netbsd-users@NetBSD.org, netbsd-java@NetBSD.org>
From: stefanos mparas <stefano@arx.net>
List: netbsd-java
Date: 06/20/2007 15:59:46
hello ,

i've installed sun's jdk/jre with linux emulation fro pkgsrc ( 
pkgsrc/lang/sun-sdk15 & sun-jre15 )
did all the things i think i had to do to make it work
like mount emul linux procfs , set env variables ( JAVA_HOME , CLASSPATH 
) etc ,

so far java (with linux emulation) works fine ,

the problem started when i installed the j2me toolkit ,
(it is used to create java applications for mobile phones and some 
embedded boards)
exact name : j2me_wireless_toolkit-2_2-linux-i386.bin  ( it's linux and 
it will run with emulation as jdk)

everything went ok with installation and running , i could run 
precompiled example applications ,
but ,
couldn't compile new ones ,
after a while a traced it down to , toolkit not being able to load and 
use the  "javac" class

decompiled code from sun's toolkit

               try
                {
                        class1 = 
toolLoader.loadClass("com.sun.tools.javac.Main");
                        method = class1.getMethod("compile", new Class[] {
                                java.lang.String[].class
                        });
                }

this error is easy reproduced if unset the CLASSPATH env  variable
and compile any java program that makes use of loadClass(".....javac.....")


i found out that the script to fire up the toolkit ( ktoolbar  )
actually uses :

javac -cp {location libraries of toolkit} other_options other_options

this way it overrides totally (i think) the CLASSPATH env which points 
to the correct tools
and here is the problem ,
if i add javac -cp location_libraries_sdk15:location_libraries_wtk it 
works ok ,

since i've recently switched from debian to netbsd at the computer where 
i work ,
i digged a little at my back up tapes from linux , and didn't observed 
anything
that could reproduce this problem on linux

a friend of mine (with more java background than me and mostly a freebsd 
guy )
pointed out that this might be happening due to not having a "native" 
installation of java

so ,
a) has anyone any thoughts on this ? could this be happening due to non 
native java ( sun-jdk instead of scsl-source-jdk )

b) could someone reproduce this with a native java installation ?

(from what i have tried on my system it's enough  to just visit
http://www.javaworld.com/javatips/jw-javatip131.html?page=2
download the simple example ,
and compile with out specifying "-cp" at the command line.

if we find a good solution ,
we can fix wip/sun-j2me package which has set PKG_FAIL_REASON
for quite a while now i think ,

thanks in advance

stefano _a_t_ arx.gr/net