This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Loading Libraries


Is System.load(String) broken? If it is I will investigate further.
I recall that this used to work in some version but can't verify that. I have also tried this using SharedLibLoader it also fails.
Linking Hello.o does work, but that is not what I need.


If someone can confirm that this is indead broken I will bury my head in the code to find out why and try to actually contribute.

Thanks guys

[steve@pascal cl]$ gcj -g --classpath=/opt/gcc-3.4/share/java/libgcj.jar:.:./v1 app.java -o app --main=app

[steve@pascal cl]$ ./app
ERROR
java.lang.ClassNotFoundException: Hello not found in [file:./, core:/]


cat app.java
class app
{
public static void main(String[] args) {
try {
System.load("/opt/NetFuel.save/gcj/gcj-jvm/cl/v1/libHello.so");
Class Klass1 = Class.forName("Hello");
String s1=(String)Klass1.getMethod("HelloString",null).invoke(null,null);
System.out.println("String from class 1 " + s1 + "\n");
} catch (Exception e) {
System.out.println("ERROR \n\t" +e);
}
}
}


cat v1/Hello.java
public class Hello
{
public static String HelloString() { return "V1 Hello";};
}

[steve@pascal cl]$ nm v1/libHello.so
00001934 A __bss_start
000017c4 d _CD_Hello
000017cc d _CT_Hello
000018ac A _DYNAMIC
00001934 A _edata
00001934 A _end
         U __gcj_personality_v0
00001928 A _GLOBAL_OFFSET_TABLE_
         U _Jv_InitClass
00001760 d _MT_Hello
000006fe r _Utf1
0000070e r _Utf2
00000728 r _Utf3
00000734 r _Utf4
0000073c r _Utf5
0000074a r _Utf6
         U _ZN4java4lang6Object5cloneEv
         U _ZN4java4lang6Object6class$E
         U _ZN4java4lang6Object6equalsEPS1_
         U _ZN4java4lang6Object8finalizeEv
         U _ZN4java4lang6Object8hashCodeEv
         U _ZN4java4lang6Object8toStringEv
         U _ZN4java4lang6ObjectC1Ev
000006d0 T _ZN5Hello11HelloStringEv
000017e0 D _ZN5Hello6class$E
000006ea T _ZN5HelloC1Ev
         U _ZTVN4java4lang5ClassE
000017a0 D _ZTVN5HelloE



[steve@pascal cl]$ gcj -v
Reading specs from /opt/gcc-3.4/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Reading specs from /opt/gcc-3.4/lib/gcc-lib/i686-pc-linux-gnu/3.4/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../configure --prefix /opt/gcc-3.4
Thread model: posix
gcc version 3.4 20030612 (experimental)


--
Steve Pribyl
Steve AT NetFuel dot com
Computer Infrastructure Practitioner


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]