gcj and JAMA

Andreas Balser a.ba@gmx.de
Mon Apr 5 09:52:00 GMT 2004


Hello,

Has anyone succeeded in compiling programs with the
JAMA-Matrix-package?

I can generate working byte-code files, but I cannot generate
executables, as the following example shows:

import Jama.Matrix;

class TestMatrix{

    public static void main (String[] args) {
	double[][] A = new double[1][1];
	A[0][0]=2;
	
	Matrix M = new Matrix(A);
	M.get(0,0);
    }
}


If I compile byte-code with 
:~/java $ gcj -C TestMatrix.java
:~/java $ java TestMatrix 

then nothing happens, i.e. it works.
However, if I try to compile an executable, then I get a
NullPointerException:

:~/java $ gcj TestMatrix.java -o TestMatrix --main=TestMatrix -L /tmp/Jama -lMatrix
:~/java $ ./TestMatrix 
Exception in thread "main" java.lang.NullPointerException
   at TestMatrix.main(java.lang.String[]) (Unknown Source)

However, when I remove the "get"-line, it works (also, compiling
hello-world works).

Any help would be appreciated!

Cheers,
Andreas

P.S.: In order to make everything as transparent as possible, I'll
detail how I obtained the matrix-library from the JAMA-sources:

/tmp $ tar xvzf Jama-1.0.1.tar.gz
[...]
:/tmp/Jama $ gcj -c *.java
:/tmp/Jama/util $ gcj -c Maths.java 
:/tmp/Jama $ ar r libMatrix.a `find . -name \*.o`



More information about the Java mailing list