Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » JNI Launcher Problem(JNI dynamic library could not be loaded)
JNI Launcher Problem [message #1701064] Thu, 09 July 2015 07:22 Go to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member
Hello,
i have a problem, if i want to run as Titan JNI Launcher the followning Message occur:

!ENTRY org.eclipse.titan.common 4 0 2015-07-08 16:28:11.135
!MESSAGE JNI dynamic library could not be loaded.

original message: no mctrjninative in java.library.path

java.library.path = /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
!STACK 1
org.eclipse.core.runtime.CoreException: JNI dynamic library could not be loaded.

original message: no mctrjninative in java.library.path
....


Maybe the java.library.path is the problem but i cant find where i can change it.
My path variable is JDKDIR := /usr/lib/jvm/java-7-openjdk-amd64 .

Do you have any idea, how to solve this issue ?

Best Regards
Johannes
Re: JNI Launcher Problem [message #1701069 is a reply to message #1701064] Thu, 09 July 2015 07:47 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Johannes,


first of all, you need to check if Titan was compiled with the "JNI enabled" option; please see README.linux for further details:

You need to have a Makefile.personal containing the following lines:

JDKDIR :=  /usr/lib/jvm/java-7-openjdk-amd64
JNI := yes



If Titan is compiled with the option JNI := yes, than a library file libmctrjninative.so is created in TTCN3_DIR/lib

TTCN3_DIR and LD_LIBRARY_FILE environment variables have to be set
accordingly( LD_LIBRARY_FILE has to include TTCN3_DIR/lib)


Please be aware that the JNI interface can be used used both by the Eclipse IDE and the Java Executor API; the latter permits control of Titan execution from Java ( see titan_executor_api/doc)

Best regards

Elemer



Re: JNI Launcher Problem [message #1701072 is a reply to message #1701069] Thu, 09 July 2015 08:14 Go to previous messageGo to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member
Hi Elemer,

yes i build the titan core with the option JNI := yes. My Makefile.personal look like your snipped and also the file libmctrjninative.so is created in TTCN3_DIR/lib.
Also i added in my bash.bashrc these lines:
TTCN3_DIR=/home/jbruder/titan/Install
PATH=$PATH:$TTCN3_DIR/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TTCN3_DIR/lib
MANPATH=$MANPATH:$TTCN3_DIR/man
TTCN3_LICENSE_FILE=/home/tmpusr/license.dat
export TTCN3_DIR PATH LD_LIBRARY_PATH MANPATH TTCN3_LICENSE_FILE

Okay the license path is not necessary but...
Should I set these Variables also in the launcher configuration again ?

Thanks..
Re: JNI Launcher Problem [message #1701075 is a reply to message #1701072] Thu, 09 July 2015 08:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Johannes,

your settings appear to be correct.....

please check java.library.path with

java -XshowSettings:properties 


to show the java.library.path value.


BR
Elemer
Re: JNI Launcher Problem [message #1701076 is a reply to message #1701075] Thu, 09 July 2015 08:25 Go to previous messageGo to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member

jbruder@jbruder-VirtualBox:~$ java -XshowSettings:properties 
Property settings:
    awt.toolkit = sun.awt.X11.XToolkit
    file.encoding = UTF-8
    file.encoding.pkg = sun.io
    file.separator = /
    java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
    java.awt.printerjob = sun.print.PSPrinterJob
    java.class.path = .
    java.class.version = 51.0
    java.endorsed.dirs = /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/endorsed
    java.ext.dirs = /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
        /usr/java/packages/lib/ext
    java.home = /usr/lib/jvm/java-7-openjdk-amd64/jre
    java.io.tmpdir = /tmp
    java.library.path = 
        /home/jbruder/titan/Install/lib
        /usr/java/packages/lib/amd64
        /usr/lib/x86_64-linux-gnu/jni
        /lib/x86_64-linux-gnu
        /usr/lib/x86_64-linux-gnu
        /usr/lib/jni
        /lib
        /usr/lib
    java.runtime.name = OpenJDK Runtime Environment
    java.runtime.version = 1.7.0_79-b14
    java.specification.name = Java Platform API Specification
    java.specification.vendor = Oracle Corporation
    java.specification.version = 1.7
    java.vendor = Oracle Corporation
    java.vendor.url = http://java.oracle.com/
    java.vendor.url.bug = http://bugreport.sun.com/bugreport/
    java.version = 1.7.0_79
    java.vm.info = mixed mode
    java.vm.name = OpenJDK 64-Bit Server VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Oracle Corporation
    java.vm.specification.version = 1.7
    java.vm.vendor = Oracle Corporation
    java.vm.version = 24.79-b02
    line.separator = \n 
    os.arch = amd64
    os.name = Linux
    os.version = 3.19.0-22-generic
    path.separator = :
    sun.arch.data.model = 64
    sun.boot.class.path = /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/sunrsasign.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jfr.jar
        /usr/lib/jvm/java-7-openjdk-amd64/jre/classes
    sun.boot.library.path = /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64
    sun.cpu.endian = little
    sun.cpu.isalist = 
    sun.io.unicode.encoding = UnicodeLittle
    sun.java.launcher = SUN_STANDARD
    sun.jnu.encoding = UTF-8
    sun.management.compiler = HotSpot 64-Bit Tiered Compilers
    sun.os.patch.level = unknown
    user.country = DE
    user.dir = /home/jbruder
    user.home = /home/jbruder
    user.language = de
    user.name = jbruder
    user.timezone = 
Re: JNI Launcher Problem [message #1701077 is a reply to message #1701076] Thu, 09 July 2015 08:35 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Johannes,


to be honest, I run out of ideas....

What exactly are you trying to accomplish? You want to run the IDE in JNI mode or you want to control execution from a separate JAVA code?
The Eclipse Executor has another mode that does not use JNI, see par. 4.1 of the Eclipse_Executor_userguide


BR Elemer


Re: JNI Launcher Problem [message #1701082 is a reply to message #1701077] Thu, 09 July 2015 08:55 Go to previous messageGo to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member
I want to execute my UDP example (see other Topic) now with the JNI Launcher. I've tried to run with Parallel Launcher inside Eclipse Plug in and it works fine as executed with command line.
If you compare the errorlog from eclipse:
 java.library.path = /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
!STACK 1 

with these output:
   java.library.path = 
        /home/jbruder/titan/Install/lib
        /usr/java/packages/lib/amd64
        /usr/lib/x86_64-linux-gnu/jni
        /lib/x86_64-linux-gnu
        /usr/lib/x86_64-linux-gnu
        /usr/lib/jni
        /lib
        /usr/lib

The path: /home/jbruder/titan/Install/lib is missing. Should be these path also there ? I cant find really a answer to modify these eclipse path.

Also in the the Eclipse_Executor_userguide i found something interesting, take look to chapter 5.6 limitations. I tried to start eclipse with these command but something goes wrong.
thank you for helping
br Johannes
Re: JNI Launcher Problem [message #1701096 is a reply to message #1701082] Thu, 09 July 2015 09:49 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Johannes,

this limitation as in 5.6 could very well be the problem;

let me ask you what goes wrong when you try to start the plug-in from the command line as indicated in 5.6?


meanwhile I got two hints from colleagues who know Java better than I do:

-in eclipse.ini one can add Java settings ; please try to set java.library.path here ; this then should be read and used by Eclipse

-the name of the launcher in:
java -classpath startup.jar Djava.library.path=$LD_LIBRARY_PATH org.eclipse.core.launcher.Main

might change; see eclipse.ini (or Google) for the current launcher name


BR Elemer

Re: JNI Launcher Problem [message #1701099 is a reply to message #1701096] Thu, 09 July 2015 10:13 Go to previous messageGo to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member
jbruder@jbruder-VirtualBox:/usr/lib/eclipse$ java -classpath startup.jar Djava.library.path=$LD_LIBRARY_PATH org.eclipse.core.launcher.Main
Fehler: Hauptklasse Djava.library.path=:.home.jbruder.titan.Install.lib konnte nicht gefunden oder geladen werden
jbruder@jbruder-VirtualBox:/usr/lib/eclipse$

Translated to english:
jbruder@jbruder-VirtualBox:/usr/lib/eclipse$ java -classpath startup.jar Djava.library.path=$LD_LIBRARY_PATH org.eclipse.core.launcher.Main
Error: Mainclass Djava.library.path=:.home.jbruder.titan.Install.lib could not be found or loaded
jbruder@jbruder-VirtualBox:/usr/lib/eclipse$

But I have a solution now: If i start eclipse with the terminal it works ! Maybe i have to define the environment variables different. I will take a look and post here the solution.

[Updated on: Thu, 09 July 2015 10:24]

Report message to a moderator

Re: JNI Launcher Problem [message #1701100 is a reply to message #1701099] Thu, 09 July 2015 10:15 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Great , Johannes,

sounds good, thank you!

BR Elemer
Re: JNI Launcher Problem [message #1701112 is a reply to message #1701100] Thu, 09 July 2015 12:40 Go to previous messageGo to next message
Johannes Bro is currently offline Johannes BroFriend
Messages: 56
Registered: June 2015
Member
I found the problem:
see : https://help.ubuntu.com/community/EnvironmentVariables
.....
The shell config file /etc/bash.bashrc is sometimes suggested for setting environment variables system-wide. While this may work on Bash shells for programs started from the shell, variables set in that file are not available by default to programs started from the graphical environment in a desktop session.
......
That is the explanation why it worked fine so far i use only the command line.
How I solved this problem ( note there are many ways see link) :
- create a new file titan_env.sh inside the /etc/profile.d/ directory. All files ending with .sh inside this folder will be considered.
- use a editor to create:
 sudo nano /etc/profile.d/titan_env.sh 

- put there all necessary path variable as described in installation guide
My file looks like this
TTCN3_DIR=/home/jbruder/titan/Install
PATH=$PATH:$TTCN3_DIR/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TTCN3_DIR/lib
MANPATH=$MANPATH:$TTCN3_DIR/man
export TTCN3_DIR PATH LD_LIBRARY_PATH MANPATH


best regards
Johannes

[Updated on: Thu, 09 July 2015 12:40]

Report message to a moderator

Re: JNI Launcher Problem [message #1715771 is a reply to message #1701112] Thu, 26 November 2015 05:27 Go to previous message
Vance Shipley is currently offline Vance ShipleyFriend
Messages: 11
Registered: June 2013
Junior Member
I found the best solution to this problem, on Ubuntu 14.04, was a change to ~/.local/share/applications/eclipse.desktop on the 'Exec=' line to prepend 'env LD_LIBRARY_PATH=<path to ttcn3 libdir>'. It seems Eclipse will override java.library.path but will include LD_LIBRARY_PATH in the new path.
Previous Topic:Tester interaction possibility
Next Topic:Compiling TTCN-2
Goto Forum:
  


Current Time: Thu Apr 25 04:20:12 GMT 2024

Powered by FUDForum. Page generated in 0.03210 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top