SunOS programming sample based on java - run error

Hello,

I have downloaded and installed the Sun OS programming sample based on Java. When I execute the 'runme' file, I obtain the following error. For information, my directories are organized like this :

|

|

|-- Solaris_JDK_1.2.1_04

|

|

|-- CAS3.0

|

|

|-- CASCADESamples

I thank you in advance for your help.

> ~/OpenCascade/CASCADESamples/java: echo $CASROOT ~/OpenCascade/CAS3.0

> ~/OpenCascade/CASCADESamples/java: export CSF_GraphicShr=$CASROOT/SunOS/lib/libOpenGl.so

> ~/OpenCascade/CASCADESamples/java: echo $CSF_GraphicShr ~/OpenCascade/CAS3.0/SunOS/lib/libOpenGl.so

> ~/OpenCascade/CASCADESamples/java: export CSF_UnitsLexicon=~/OpenCascade/CASCADESamples/java/etc/Lexi_Expr.dat

> ~/OpenCascade/CASCADESamples/java: echo $CSF_UnitsLexicon ~/OpenCascade/CASCADESamples/java/etc/Lexi_Expr.dat

> ~/OpenCascade/CASCADESamples/java: export CSF_UnitsDefinition=~/OpenCascade/CASCADESamples/java/etc/Units.dat

> ~/OpenCascade/CASCADESamples/java: echo $CSF_UnitsDefinition ~/OpenCascade/CASCADESamples/java/etc/Units.dat

> ~/OpenCascade/CASCADESamples/java: export LD_LIBRARY_PATH=~/OpenCascade/CASCADESamples/java:$LD_LIBRARY_PATH

> ~/OpenCascade/CASCADESamples/java: echo $PATH ~/OpenCascade/CAS3.0/SunOS/lib:~/OpenCascade/Solaris_JDK_1.2.1_04/bin:~/OpenCascade/TCL7.6/bin:~/OpenCascade/TK4.2/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/opt/SUNWspro/bin:/SunSolve/bin:/usr/ucb:/outils/fenetra_d:/freeware/bin:/outils/Frame/bin:/outils/Tecplot/Tec75/bin:.

> ~/OpenCascade/CASCADESamples/java: echo $LD_LIBRARY_PATH ~/OpenCascade/CASCADESamples/java:~/OpenCascade/CAS3.0/SunOS/lib:~/OpenCascade/Solaris_JDK_1.2.1_04/lib:~/OpenCascade/TCL7.6/lib:~/OpenCascade/TK4.2/lib:/usr/lib:/usr/openwin/lib:/usr/dt/lib:/opt/SUNWspro/lib

> ~/OpenCascade/CASCADESamples/java: java -classpath .:CASCADESamples.jar SamplesStarter Exception in thread "main" java.lang.UnsatisfiedLinkError: no CASCADESamplesJni in java.library.path

at java.lang.Throwable.fillInStackTrace(Native Method)

at java.lang.Throwable.fillInStackTrace(Compiled Code)

at java.lang.Throwable.(Compiled Code)

at java.lang.Error.(Error.java:50)

at java.lang.LinkageError.(LinkageError.java:43)

at java.lang.UnsatisfiedLinkError.(UnsatisfiedLinkError.java:42)

at java.lang.ClassLoader.loadLibrary(Compiled Code)

at java.lang.Runtime.loadLibrary0(Compiled Code)

at java.lang.System.loadLibrary(Compiled Code)

at

at SampleGeometryPanel.createViewPanel(SampleGeometryPanel.java:164)

at SamplePanel.jbInit(SamplePanel.java:51)

at SamplePanel.(SamplePanel.java:28)

at SampleGeometryPanel.(SampleGeometryPanel.java:130)

at SamplesStarter.(SamplesStarter.java:68)

at SamplesStarter.main(SamplesStarter.java:168)

Natalia Kopnova's picture

Hello,

Java looks for the libraries by path from LD_LIBRARY_PATH variable. Try to check your path settings and location of libraries.

Best regards, Natalia.

Daniel SIDOBRE's picture

Hello,

I have the same problem !

Please, explain your response. In the first post Christelle J. give her LD_LIBRARY_PATH.

This path contain the directory .../OpenCascade/CASCADESamples/java. This directory contain the file .../CASCADESamples/java/libCASCADESamplesJni.so

What file java doesn't find when it write

> Exception in thread "main"
> java.lang.UnsatisfiedLinkError: no
> CASCADESamplesJni in java.library.path
> at java.lang.Throwable.fillInStackTrace(Native
> Method) ... ?

Daniel S.

Natalia Kopnova's picture

libCASCADESamplesJni.so needs only standard CASCADE libraries and some additional libraries which also should be in the CASCADESamples/java directory. This problem might be connected with Java. I had the same situation (but only on WinNT) when used JDK 1.2.1. Sometimes, without any apparent causes, Java couldn't load native libraries and wrote the same message. This problem was solving by adding or removing the loading libraries to (or from) "main" function. Try to use JDK 1.2.2 which works more correct comparing to the previous version.

Natalia.

Christelle Jamonac's picture

Hello Natalia,

I thank you for your response. I installed JDK 1.2.2 and when I used it to run the file runme.csh, I had the same error. I'm not familiar with java native libraries so I don't understand the solution you propose. You say that it can be solved by adding or removing the loading libraries to (or from) "main" function. What does it mean ? Could you explain to me more precisely what I have to do ?

I thank you for your help.

Best regards, Christelle.

Natalia Kopnova's picture

Hello Christelle,

It means that you should edit SamplesStarter.java file by adding the following code into main() function just after 'try-catch' block:

System.loadLibrary("CASCADESamplesJni");

Then rebuild it with help of build.csh script. But before it, please, be sure that you have the same versions of the OpenCASCADE libraries and the samples. Maybe the problem is that Java cannot load some dependent library.

One more way is try to rebuild libraries (see readme.txt file for details), copy new libraries to java directory and run again.

Hope it will help, Natalia.