CyberCastle / jLibuvc

Java wrapper for libuvc
GNU General Public License v2.0
4 stars 2 forks source link

no jniUVCController in java.library.path #2

Closed lobsteroh closed 9 years ago

lobsteroh commented 9 years ago

the libuvc installation with dylib exists /opt/local/lib/ and works well with my libuvc examples in C. i am trying to get the java wrapper to work in its most simplified form and am running into link error ...

public static void main(String... arg) throws InterruptedException { System.load("/opt/local/lib/libuvc.dylib"); System.out.println("\"We weighed anchor in anger, set sail for revenge ...\""); UVCContext ctx = new UVCController.UVCContext(); int res = UVCController.uvc_init(ctx, null); }

UVCController.uvc_init() throws ...

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniUVCController in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:550) at org.bytedeco.javacpp.Loader.load(Loader.java:415) at org.bytedeco.javacpp.Loader.load(Loader.java:358) at cl.cc.jlibuvc.UVCController.(UVCController.java:123) at Load.main(Load.java:22)

any suggestions greatly appreciated ...

CyberCastle commented 9 years ago

Hi: In Netbeans IDE: -. Clean & Build project -. Run project This issue is because the native library did not find in the classpath. I'm investigating how package dylib in a jar file and run project from maven.

Greetings

lobsteroh commented 9 years ago

hi cybercastle, thanks a major stack. this is an important feature for me and i am soooo itching to get this to work as it would allow me to start playing with my webcam from within my own project, rather than running a separate App from C for that. All of my Java (and C/C++) development is in eclipse and am not familiar with netbeans. Do i need to switch to netbeans to get this project to work or can i make it work in eclipse? Any help you could provide for getting me over this initial hump would be hugely appreciated. If you'd be willing to email me for a quick chat, I would be eternally grateful. my name is robert huber lobsterman.bgsu@gmail.com at the Radcliffe Institute in Boston.

CyberCastle commented 9 years ago

Hi Robert:

No need to use Netbeans. In eclipse it should also be possible to run the project. I will try pack the dylib in the jar file.

Greetings

lobsteroh commented 9 years ago

hi cybercastle, i think i am stuck just ahead of that. i don't have a .jar file for the llibuvc as i am having problems compiling the downloaded jlibuvc source into the jar. do you know of a place where i can download the current jar or would you be willing to send me a copy of it? i then know how to set the dylib's native library location for the jar. thanks a stack

On Tue, Oct 13, 2015 at 8:32 AM CyberCastle notifications@github.com wrote:

Hi Robert:

No need to use Netbeans. In eclipse it should also be possible to run the project. I will try pack the dylib in the jar file.

Greetings

— Reply to this email directly or view it on GitHub https://github.com/CyberCastle/jLibuvc/issues/2#issuecomment-147701649.

Robert

Robert Huber, PhD Helen Putnam Fellow, Radcliffe Institute for Advanced Study Harvard University, Cambridge, MA 02138 Professor, Biological Sciences, BGSU Associate Editor - Acta Ethologica Associate Editor - Frontiers in Physiology Email: rh.bgsu@gmail.com


CyberCastle commented 9 years ago

Hi Robert:

Please, try again with the new version published in the repository. This update, package the native lib in jar file.

For generate jar file: maven package And for run file: java -jar target/dist/jLibUVC.jar

Greetings

lobsteroh commented 9 years ago

Hi Cybercastle, thanks, 1 step closer. am using mvn with mvn package from terminal ... missing libusb-1.0/libusb.h header which is in my system at /opt/local/include i am including the terminal output. any suggestions how to get past this last bump? thanks

Last login: Tue Oct 13 09:45:56 on ttys000

Roberts-MacBook-Pro:~ lobsterman$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home

Roberts-MacBook-Pro:~ lobsterman$ cd /Users/lobsterman/Downloads/jLibuvc-master

Roberts-MacBook-Pro:jLibuvc-master lobsterman$ mvn package

[INFO] Scanning for projects...

[INFO]

[INFO]

[INFO] Building jLibUVC 1.1

[INFO]

[INFO]

[INFO] --- maven-dependency-plugin:2.10:properties (default) @ jLibUVC ---

[INFO]

[INFO] --- javacpp:1.0:build (generate-sources) @ jLibUVC ---

[INFO] Executing JavaCPP Builder

[INFO] Generating /Users/lobsterman/Downloads/jLibuvc-master/target/classes/jniUVCController.cpp

[INFO] Compiling /Users/lobsterman/Downloads/jLibuvc-master/target/classes/libjniUVCController.dylib

[INFO] g++ -I/usr/local/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/include/darwin /Users/lobsterman/Downloads/jLibuvc-master/target/classes/jniUVCController.cpp -luvc -Wl,-rpath,@loader_path/. -march=x86-64 -m64 -Wall -O3 -fPIC -dynamiclib -undefined dynamic_lookup -o /Users/lobsterman/Downloads/jLibuvc-master/target/classes/libjniUVCController.dylib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -framework JavaVM

In file included from /Users/lobsterman/Downloads/jLibuvc-master/target/classes/jniUVCController.cpp:63:

/usr/local/include/libuvc/libuvc.h:9:10: fatal error: 'libusb-1.0/libusb.h' file not found

include <libusb-1.0/libusb.h>

     ^

1 error generated.

Roberts-MacBook-Pro:jLibuvc-master lobsterman$

On Tue, Oct 13, 2015 at 9:17 AM CyberCastle notifications@github.com wrote:

Hi Robert:

Please, try again with the new version published in the repository. This update, package the native lib in jar file.

For generate jar file: maven package And for run file: java -jar target/dist/jLibUVC.jar

Greetings

— Reply to this email directly or view it on GitHub https://github.com/CyberCastle/jLibuvc/issues/2#issuecomment-147711230.

Robert

Robert Huber, PhD Helen Putnam Fellow, Radcliffe Institute for Advanced Study Harvard University, Cambridge, MA 02138 Professor, Biological Sciences, BGSU Associate Editor - Acta Ethologica Associate Editor - Frontiers in Physiology Email: rh.bgsu@gmail.com


CyberCastle commented 9 years ago

Robert:

Using Homebrew (http://brew.sh/) install libuvc in your mac:

brew install jpeg (for jpeg support) brew install libuvc --HEAD (this version fixed a error in the header file)

And recompile the proyect again.

Greetings

lobsteroh commented 9 years ago

sir,

you are the master of the universe and a big hero of mine from now on ... what a bunch of joy to see the install just click by and end with...

[INFO] Building jar: /Users/rhuber/Documents/workspace/jLibuvc-master/target/dist/jLibUVC.jar

[INFO]

[INFO] --- maven-dependency-plugin:2.10:copy-dependencies (copy-dependencies) @ jLibUVC ---

[INFO] Copying javacpp-1.0.jar to /Users/rhuber/Documents/workspace/jLibuvc-master/target/dist/lib/javacpp-1.0.jar

[INFO]

[INFO] BUILD SUCCESS

[INFO]

[INFO] Total time: 35.002 s

[INFO] Finished at: 2015-10-13T12:27:35-04:00

[INFO] Final Memory: 22M/90M

[INFO]

this means i now have the .jar and nothing can stop me now :-)

may i suggest that you add to the readme.md file the note to compile this into jLibUVC.jar by first changing into the directory where the pom.xml file is, then compile with maven using the command "mvn package". that would be really useful for folks like me who stumble into this from a very different background. ok, off i go back to actually writing code, rather than pulling my hair out.

thanks again, I owe you many beers if your travels ever bring you to the northern parts of the continent. be well,

On Tue, Oct 13, 2015 at 10:16 AM CyberCastle notifications@github.com wrote:

Robert:

Using Homebrew (http://brew.sh/) install libuvc in your mac:

brew install jpeg (for jpeg support) brew install libuvc --HEAD (this version fixed a error in the header file)

And recompile the proyect again.

Greetings

— Reply to this email directly or view it on GitHub https://github.com/CyberCastle/jLibuvc/issues/2#issuecomment-147727716.

Robert

Robert Huber, PhD Helen Putnam Fellow, Radcliffe Institute for Advanced Study Harvard University, Cambridge, MA 02138 Professor, Biological Sciences, BGSU Associate Editor - Acta Ethologica Associate Editor - Frontiers in Physiology Email: rh.bgsu@gmail.com