undefined symbol: JAWT_GetAWT
Hello everybody,
i tried the example at http://java.sun.com/javase/6/docs/technotes/guides/awt/AWT_Native_Interface.html
on Linux, but unfortunately there are no instructions how to compile the native code.
So I tried the following steps:
1. javah -classpath bin MyCanvas
2. g++ -shared -fPIC -o libMyCanvas.so -I/usr/local/jdk1.6.0_01/include -I/usr/local/jdk1.6.0_01/include/linux MyCanvas.cpp
3. export LD_LIBRARY_PATH=/home/genesis/jawt
4. java -cp bin MyCanvas
But java gives me the following error:
java: symbol lookup error: /home/genesis/jawt/libMyCanvas.so: undefined symbol: JAWT_GetAWT
I think the problem has something to do with the compiling/linking stage, but I don't know what I did wrong.
# 1
> Hello everybody,
>
> i tried the example at
> http://java.sun.com/javase/6/docs/technotes/guides/awt
> /AWT_Native_Interface.html
> on Linux, but unfortunately there are no instructions
> how to compile the native code.
> So I tried the following steps:
> > 1. javah -classpath bin MyCanvas
> 2. g++ -shared -fPIC -o libMyCanvas.so
> -I/usr/local/jdk1.6.0_01/include
> -I/usr/local/jdk1.6.0_01/include/linux MyCanvas.cpp
> 3. export LD_LIBRARY_PATH=/home/genesis/jawt
> 4. java -cp bin MyCanvas
>
>
> But java gives me the following error:
> java: symbol lookup error:
> /home/genesis/jawt/libMyCanvas.so: undefined symbol:
> JAWT_GetAWT
>
> I think the problem has something to do with the
> compiling/linking stage, but I don't know what I did
> wrong.
Did you link you code with the jawt shared library?
# 3
Hello there,
I am having the same issue you were having and I am not sure how to resolve my issue though. Here is what I am doing.
g++ -c -fpic *_wrap.cxx -I/opt/packages/jdk1.6.0/include/ -I -I/opt/packages/jdk1.6.0/include/linux
g++ -shared -fpic *_wrap.o -Wl -o libselffold.so
"Basically I am building a java wrapper around a c++ library. I have ran some examples from the web and they seem to work fine but when I tried to use my own library that I built I get the following error. PS. the c++ library has been tested and it works fine using c++"
Based on your case, it looks like I have a linker issue.So when I ran my code here is the error I keep getting.
java: symbol lookup error: lib/libselffold.so: undefined symbol: _ZN8selffoldC1Ev
Please let me know if you can give me some hints to resolve my issue. And to tell you the truth I am relatively newbie in regard to c++ and java too. So any details will be highly appreciated.
Regards,
Jazi