I can compile SWT apps using javac, and in the Eclipse SDK.
Any ideas about what I need to do to get libswt up and running? BTW, I am really glad that this project is here! I
can't wait to make java apps run native!
Thanks,
Jason Woodward
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"jni.h" is a system header. If your gcc was compiled with java support, it should just find jni.h without you doing anything. In general, if you can compile with gcj, then gcc should probably be able to find jni.h without any hints.
So, have you ever compiled anything with gcj? If not, try to compile "hello world".
It sounds as though you know java, so I will assume you can write HelloWorld.java :-) Here is the syntax for compiling it with gcj:
The --main=xxx option just tells gcj that class xxx is the one to actually execute. In principal, there could be many classes with many mains, and gcj wouldn't know which one to treat as the "real" main.
Let me know what happens.
--McKenzie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to install the 2 older versions of support with no luck also, but the ./configure completed on those ones, but it still said no jni.h. make did not work though, saying that there was no jni.h..
I am running Mandrake 10.0 Official, and had the same problem on Mandrake 10 Community when I tried to install this a couple months ago.
I also tried linking the gcj and the java sdk jni.h to /usr/include to see if maybe it just wasn't seeing it, but that did no good either. Also I probably should have posted more info on the error. Here is all the info shown about jni.h during ./configure:
creating libtool
checking jni.h usability... no
checking jni.h presence... no
checking for jni.h... no
configure: error: Can't find jni.h
thanks again,
Jason Woodward
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The fact that configure completed on the previous versions of the libswt support library is not significant. Those versions had a bug where they proceeded to completion even when jni.h could not be found.
I still believe that there is something wrong with your gcc installation that it doesn't find jni.h. The system should know where to find system headers!
But, if the jni.h that you have is good (i.e., it matches your gcc and gcj versions), you can just add an include flag for it to the CFLAGS environment variable prior to running ./configure.
Based on your first post, that would look like this:
Using export CFLAGS=-I/usr/include/libgcj-3.3.2\ $CFLAGS worked. I was able to install both the support and then the libswt. I can't run ./Hello though. I get an error saying:
./Hello: error while loading shared libraries: libswt-gtk2.so: cannot open shared object file: No such file or directory
When I run ./configure for libswt-gtk2-support-2.1.1-4, I get
an error saying that it can't find jni.h. Here is the error:
checking for jni.h... no
configure: error: Can't find jni.h
I tried in Bash:
locate jni
/usr/include/libgcj-3.3.2/jni.h
/usr/java/j2sdk1.4.2_05/include/linux/jni_md.h
/usr/java/j2sdk1.4.2_05/include/jni.h
/usr/java/j2sdk1.4.2_05/jre/lib/i386/libjavaplugin_jni.so
I can compile SWT apps using javac, and in the Eclipse SDK.
Any ideas about what I need to do to get libswt up and running? BTW, I am really glad that this project is here! I
can't wait to make java apps run native!
Thanks,
Jason Woodward
doh... thought I was in help.... sorry
"jni.h" is a system header. If your gcc was compiled with java support, it should just find jni.h without you doing anything. In general, if you can compile with gcj, then gcc should probably be able to find jni.h without any hints.
So, have you ever compiled anything with gcj? If not, try to compile "hello world".
It sounds as though you know java, so I will assume you can write HelloWorld.java :-) Here is the syntax for compiling it with gcj:
$ gcj -o HelloWorld --main=HelloWorld HelloWorld.java
The --main=xxx option just tells gcj that class xxx is the one to actually execute. In principal, there could be many classes with many mains, and gcj wouldn't know which one to treat as the "real" main.
Let me know what happens.
--McKenzie
Hi McKenzie,
Thank you for responding.
I can compile HelloWorld.java with gcj.
I tried to install the 2 older versions of support with no luck also, but the ./configure completed on those ones, but it still said no jni.h. make did not work though, saying that there was no jni.h..
I am running Mandrake 10.0 Official, and had the same problem on Mandrake 10 Community when I tried to install this a couple months ago.
I also tried linking the gcj and the java sdk jni.h to /usr/include to see if maybe it just wasn't seeing it, but that did no good either. Also I probably should have posted more info on the error. Here is all the info shown about jni.h during ./configure:
creating libtool
checking jni.h usability... no
checking jni.h presence... no
checking for jni.h... no
configure: error: Can't find jni.h
thanks again,
Jason Woodward
The fact that configure completed on the previous versions of the libswt support library is not significant. Those versions had a bug where they proceeded to completion even when jni.h could not be found.
I still believe that there is something wrong with your gcc installation that it doesn't find jni.h. The system should know where to find system headers!
But, if the jni.h that you have is good (i.e., it matches your gcc and gcj versions), you can just add an include flag for it to the CFLAGS environment variable prior to running ./configure.
Based on your first post, that would look like this:
$ export CFLAGS=-I/usr/include/libgcj-3.3.2\ $CFLAGS
$ ./configure
Try this and let me know how it goes.
I might as well mention that non-bash users may need to use a different syntax to set environment variables.
Using export CFLAGS=-I/usr/include/libgcj-3.3.2\ $CFLAGS worked. I was able to install both the support and then the libswt. I can't run ./Hello though. I get an error saying:
./Hello: error while loading shared libraries: libswt-gtk2.so: cannot open shared object file: No such file or directory
locate libswt-gtk2.so shows: /usr/local/lib/libswt-gtk2.so
I found the answer in another post on this forum:
$ export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
$ ./Hello
Thanks again for your help,
Jason