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]

Jv_CreateJavaVM problems


Hey GCJ guys

At one point there was a work around for the arg[0] related problems documented in problem 8685. If one called _Jv_ThisExecutable("Some String") Jv_CreateJavaVm would succeed.

In recent snapshots the _Jv_ThisExecutable has been removed so this workaround no longer works.

If anyone can tell me what I need to do to get this to work I would appreciate it.

TIA
Steve

Here is my source
[steve at pascal gcj-jvm]$ cat Hello.cpp
#include <gcj/cni.h>

int main(int argc, char* argv)
{
        JvCreateJavaVM (NULL);
        JvAttachCurrentThread(NULL,NULL);

JvDetachCurrentThread();

}

Here is the command used to build it
[steve at pascal gcj-jvm]$ g++ -L/opt/gcc/lib -I/opt/gas/include Hello.cpp -lgcj -static -ldl -lpthread -o Hello



Here is the stack trace (gdb) run Starting program: /opt/NetFuel/gcj/gcj-jvm/Hello

Program received signal SIGSEGV, Segmentation fault.
0x08078f50 in java::lang::Runtime::insertSystemProperties(java::util::Properties*) (newprops=0x82d3fc8) at ../../../libjava/gcj/cni.h:64
64 {
Current language: auto; currently c++
(gdb) wher
#0 0x08078f50 in java::lang::Runtime::insertSystemProperties(java::util::Properties*) (newprops=0x82d3fc8) at ../../../libjava/gcj/cni.h:64
#1 0x08084805 in java.lang.Runtime.<clinit>() () at ../../../libjava/java/lang/Runtime.java:111
#2 0x08073cc3 in java::lang::Class::initializeClass() (this=0x0) at ../../../libjava/java/lang/natClass.cc:814
#3 0x0808856d in java.lang.System.<clinit>() () at ../../../libjava/java/lang/System.java:99
#4 0x08073cc3 in java::lang::Class::initializeClass() (this=0x81e8600) at ../../../libjava/java/lang/natClass.cc:814
#5 0x08087e88 in java.lang.System.getProperty(java.lang.String) (key=0x1) at ../../../libjava/java/lang/System.java:393
#6 0x0808a933 in java.lang.Throwable.<clinit>() () at ../../../libjava/java/lang/Throwable.java:403
#7 0x08073cc3 in java::lang::Class::initializeClass() (this=0x81e8600) at ../../../libjava/java/lang/natClass.cc:814
#8 0x08073cfc in java::lang::Class::initializeClass() (this=0x81e8600) at ../../../libjava/java/lang/Class.h:265
#9 0x08073cfc in java::lang::Class::initializeClass() (this=0x81e8600) at ../../../libjava/java/lang/Class.h:265
#10 0x08073cfc in java::lang::Class::initializeClass() (this=0x81e8600) at ../../../libjava/java/lang/Class.h:265
#11 0x08048a83 in _Jv_AllocObjectNoFinalizer (klass=0x81e8600, size=20) at ../../../libjava/java/lang/Class.h:265
#12 0x08048aae in _Jv_AllocObject (klass=0x1, size=0) at ../../../libjava/prims.cc:391
#13 0x0804977b in _Jv_CreateJavaVM(void*) () at ../../../libjava/prims.cc:897
#14 0x08048241 in JvCreateJavaVM(void*) ()
#15 0x08048210 in main ()
#16 0x08132e72 in __libc_start_main ()


Here is the g++ version
[steve at pascal gcj-jvm]$ g++ -v
Reading specs from /opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../configure --prefix=/opt/gcc
Thread model: posix
gcc version 3.3 20030331 (prerelease)
[steve at pascal gcj-jvm]$



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