## UnsatisfiedLinkError: no remoteApiJava - on Linux

Typically: "How do I... ", "How can I... " questions
BenderBot
Posts: 10
Joined: 03 Sep 2013, 22:43

### UnsatisfiedLinkError: no remoteApiJava - on Linux

Hello, I'm having an issue testing the java remote API on linux, specifically Debian Wheezy on a raspberry pi. When trying to run simpleTest.java I receive the error

I have ensured the files in \V-REP_PRO_EDU_V3_0_4_Linux\programming\remoteApiSharedLib\ are in the path(s) specified by the java -XshowSettings:properties command.

I have also placed it other locations and used the -Djava.library.path= switch to point to the new path. Everytime I get the same error.

Here is an example:

Code: Select all

pi@raspberrypi ~/Java/VREP $sudo /opt/jdk1.8.0/bin/java -Djava.library.path=/lib -jar VREP.jar Program started Exception in thread "main" java.lang.UnsatisfiedLinkError: no remoteApiJava in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886) at java.lang.Runtime.loadLibrary0(Runtime.java:845) at java.lang.System.loadLibrary(System.java:1085) at coppelia.remoteApi.<clinit>(remoteApi.java:31) at simpleTest.main(simpleTest.java:28)  Anything I'm doing wrong? Thanks coppelia Site Admin Posts: 7396 Joined: 14 Dec 2012, 00:25 ### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux Hello, can you have a look at this post (second part only) and check if this works for you? (the first part of the post was still during V-REP V3.0.3, so you shouldn't be downloading the fixed source) Cheers BenderBot Posts: 10 Joined: 03 Sep 2013, 22:43 ### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux I renamed remoteApiJava.so to libremoteApiJava.so which seemed to solve the original problem. But now I have error indicating it can't run on Arm architecture. This is on a Raspberry Pi using Java 1.8 pi@raspberrypi ~$ sudo /opt/jdk1.8.0/bin/java -jar Java/VREP/VREP.jar Program started
Exception in thread "main" java.lang.UnsatisfiedLinkError: /lib/libremoteApiJava.so: /lib/libremoteApiJava.so: cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)
at coppelia.remoteApi.<clinit>(remoteApi.java:31)
at simpleTest.main(simpleTest.java:28)
Any help would be appreciated. There does seem to be ways to fix the issue however I am not familiar with C/C++, and not quite sure of the difficulty.

coppelia
Posts: 7396
Joined: 14 Dec 2012, 00:25

### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux

Hello,

You will very probably have to recompile the remote API shared library for your platform:

in the programming folder, type:

Code: Select all

make -f remoteApiSharedLibJava_Makefile
This should build remoteApiJava.so. On linux, do not forget to rename it to libremoteApiJava.so, since Java's system.loadLibrary will automatically append a "lib" to the filename.

Cheers

BenderBot
Posts: 10
Joined: 03 Sep 2013, 22:43

### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux

Thank you it worked.

I can now run simpleTest.java . I'm hoping now you or anyone can help me with my new problem :) I cannot connect to the V-rep server from a Raspberry Pi. I have ensured the server is running since I can connect to it from the same windows machine and simpleTest runs, I can see the output showing the amount of objects as well as the connection on the V-REP console.

On the Pi it times out everytime. I have disabled firewall on both the Pi and the Windows machine running V-REP. I've ran a Wireshark scan against the Pi and it never is actually sending any data during the simpleTest run. I can get on a webbrowser on the Pi and browse out to the V-REP server on the same port 19999 and can see the traffic on Wireshark so I know the connection can be made. It seems like the application isn't able to use the Pi's ethernet adapter. I've tried wired and wireless, different ports, building the .so with JDK 1.7 and other various things but I can't get anywhere.

Know what might be the issue?

coppelia
Posts: 7396
Joined: 14 Dec 2012, 00:25

### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux

It seems that the remote API client cannot send out data. Could you add some debugging printfs in the functions:
• extApi_connectToServer_socket
• extApi_send_socket
• extApi_recv_socket
which are located in file extApiPlatform.c Those are the only platform specific communication functions in the remote API client. You will of course have to rebuild the shared library.

Cheers

BenderBot
Posts: 10
Joined: 03 Sep 2013, 22:43

### Re: UnsatisfiedLinkError: no remoteApiJava - on Linux

Thanks again, it's working!

After adding some debugging printf's I was able to find the problem on my system.

The following in extApiPlatform.c would result in hp being assigned NULL.

Code: Select all

hp=gethostbyaddr((char*)&addr,sizeof(addr),AF_INET);

After adding a case switch to determine which error was being generated I found gethostbyaddr was returning HOST_NOT_FOUND.

The problem was resolved by adding my V-REP server in the /etc/hosts file on the Pi, which in my case was simply: 10.20.120.103 Win7-PC

I'm wondering if my V-REP server had a FQDN that this may not have been an issue. Either way it is working now.
Thanks again.