can't run *.class with GIJ

Utku Ozcan utku.ozcan@netas.com.tr
Sun Oct 20 04:02:00 GMT 2002


Platform iis:

* Sun Solaris 2.6
* Java 1.1.3
* GCC 3.2
* no CLASSPATH defined

GIJ doesn't seem to run *.class files by me.

I have following HelloWorldApp.java:

class HelloWorldApp {
                public static void main(String[] args) {
                    System.out.println("Hello World!"); //Display the string.
                }
            }

Following works (without CLASSPATH):

1. Pure Java

unix> javac HelloWorldApp.java
unix> ls HelloWorldApp.class
HelloWorldApp.class
unix> java HelloWorldApp
Hello World!

2. GCJ + Java

unix> rm *.class
unix> gcj -C HelloWorldApp.java
unix> ls HelloWorldApp.class
HelloWorldApp.class
unix> java HelloWorldApp
Hello World!

Following didn't work:

1. http://gcc.gnu.org/java/faq.html#1_7 (no CLASSPATH defined)

unix> gcj -shared -o HelloWorldApp.so HelloWorldApp.java
Text relocation remains                 	referenced
    against symbol		    offset	in file
<unknown>                           0xb4      	/var/tmp/ccQdiPmu.o
<unknown>                           0xb0      	/var/tmp/ccQdiPmu.o
java::lang::System::class$          0x64      	/var/tmp/ccQdiPmu.o
java::lang::System::class$          0x60      	/var/tmp/ccQdiPmu.o
java::lang::System::class$          0x1c      	/var/tmp/ccQdiPmu.o
java::lang::System::class$          0x18      	/var/tmp/ccQdiPmu.o
java::lang::System::out             0x7c      	/var/tmp/ccQdiPmu.o
java::lang::System::out             0x78      	/var/tmp/ccQdiPmu.o
_Jv_InitClass                       0x68      	/var/tmp/ccQdiPmu.o
_Jv_InitClass                       0x10      	/var/tmp/ccQdiPmu.o
HelloWorldApp::class$               0x8       	/var/tmp/ccQdiPmu.o
HelloWorldApp::class$               0xc       	/var/tmp/ccQdiPmu.o
_Jv_ThrowNullPointerException       0x98      	/var/tmp/ccQdiPmu.o
java::lang::Object::Object[in-charge]()0xe4      	/var/tmp/ccQdiPmu.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
unix> 

2. GCJ + GIJ (no CLASSPATH defined)

unix> rm *.class
unix> gcj -C HelloWorldApp.class
unix> gij HelloWorldApp
GC Warning: Large stack limit(134217728): only scanning 8 MB
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
unix>

Not to mention,

I have tried:

a. gij -jar
b. gij --classpath
c. setenv CLASSPATH to libgcj.jar

but no success!!

Funny is that java 1.1.3 can run class bytecode generated by GCJ!!

What is the problem by me? Why can't I run GIJ??

Utku



More information about the Java mailing list