problem with GCJ while running java code

gforgcc narendra.ka@lntemsys.com
Wed Feb 13 11:31:00 GMT 2008


Hi friends 
I have a problem while running a java code with GCJ...
i recently cross compiled GCC for arm with added language option as java. so
i got arm-unknown-linux-gnu-gcj..
My java code is 

class helloworld
{
    static public void main(String argc[])
   {
         System.out.println("Hello World !");
   }
}

so i am crosscompiling my java code like this...
arm-unknown-linux-gnu-gcj -g --main=helloworld -o helloworld helloworld.java
and running like this
./helloworld 
the above should print Hello World ! as far as my understanding since GCJ
does not require JVM
while compiling and running it is not giving any error or warning.. 
but to some extent GDB helped me to atleast post here.. 
this is my GDB dump.. 

GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i386-pc-linux-gnu
--target=arm-unknown-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x899c: file /var/tmp/ccdniIeT.i, line 10.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0xb5e88330 in ?? ()
(gdb) c
Continuing.

Breakpoint 1, main (argc=1, argv=0xb7f06824) at /var/tmp/ccdniIeT.i:10
10      /var/tmp/ccdniIeT.i: No such file or directory.
        in /var/tmp/ccdniIeT.i
(gdb) s
11      in /var/tmp/ccdniIeT.i
(gdb) s
JvRunMain (klass=Variable "klass" is not available.
)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:1370
1370      _Jv_RunMain (klass, NULL, argc, argv, false);
Current language:  auto; currently c++
(gdb) s
1368    JvRunMain (jclass klass, int argc, const char **argv)
(gdb) s
1370      _Jv_RunMain (klass, NULL, argc, argv, false);
(gdb) s
1368    JvRunMain (jclass klass, int argc, const char **argv)
(gdb) s
1370      _Jv_RunMain (klass, NULL, argc, argv, false);
(gdb) s
s_Jv_RunMain (klass=Variable "klass" is not available.
)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:1364
1364      _Jv_RunMain (NULL, klass, name, argc, argv, is_jar);
(gdb) s
1362                 bool is_jar)
(gdb) s
1364      _Jv_RunMain (NULL, klass, name, argc, argv, is_jar);
(gdb) s
_Jv_RunMain (vm_args=Variable "vm_args" is not available.
)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:1314
1314      java::lang::Runtime *runtime = NULL;
(gdb) s
1308                 const char **argv, bool is_jar)
(gdb) s
1314      java::lang::Runtime *runtime = NULL;
(gdb) s
1308                 const char **argv, bool is_jar)
(gdb) s
1311      _Jv_SetArgs (argc, argv);
(gdb) s
_Jv_SetArgs (argc=1, argv=0xb7f06824)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:117
117       _Jv_argc = argc;
(gdb) s
115     _Jv_SetArgs (int argc, const char **argv)
(gdb) s
117       _Jv_argc = argc;
(gdb) s
118       _Jv_argv = argv;
(gdb) s
117       _Jv_argc = argc;
(gdb) s
118       _Jv_argv = argv;
(gdb) s
119     }
(gdb) s
_Jv_RunMain (vm_args=Variable "vm_args" is not available.
)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:1318
1318          if (_Jv_CreateJavaVM (vm_args) < 0)
(gdb) s
_Jv_CreateJavaVM (vm_args=Variable "vm_args" is not available.
)
    at
/home/developer/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-4.0.1-glibc-2.3.2/gcc-4.0.1/libjava/prims.cc:1211
1211    _Jv_CreateJavaVM (JvVMInitArgs* vm_args)
(gdb) s
1215      if (runtimeInitialized)
(gdb) s
1144      if (_Jv_Compiler_Properties)
(gdb) s
1218      runtimeInitialized = true;
(gdb) s
1144      if (_Jv_Compiler_Properties)
(gdb) s
1149          for (int i = 0; props[i]; i++)
(gdb) s
1147          _Jv_Compiler_Properties = NULL;
(gdb) s
1149          for (int i = 0; props[i]; i++)
(gdb) s
1158      if (vm_args == NULL)
(gdb) s
852       char *props = getenv("GCJ_PROPERTIES");
(gdb) s
857       if (NULL == props)
(gdb) s
1228      _Jv_InitThreads ();

really dunno what is wrong why is showing those warnings.. as highlighted in
the dump..
what is the meaning of all those.. 
please help me to solve this problem...
i just need it to print Hello World !
thanks... :) :) 
-- 
View this message in context: http://www.nabble.com/problem-with-GCJ-while-running-java-code-tp15455624p15455624.html
Sent from the gcc - java mailing list archive at Nabble.com.



More information about the Java mailing list