Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble using java lib #40

Closed
meza opened this issue Feb 1, 2013 · 10 comments
Closed

trouble using java lib #40

meza opened this issue Feb 1, 2013 · 10 comments

Comments

@meza
Copy link

meza commented Feb 1, 2013

Hi,
I'm trying to us the java library. I've added the jar to my classpath, and set the LD_LIBRARY_PATH to point to the libBlink1.so's directory.

Now when I start using my device, I get this:

blink1/libraries/libBlink1.so: undefined symbol: hid_enumerate

@meza
Copy link
Author

meza commented Feb 1, 2013

[blink1/libraries]$ export LD_LIBRARY_PATH=. && java -jar blink1.jar

even this produces the same

@todbot
Copy link
Owner

todbot commented Feb 1, 2013

Hi Maza,
Take a look at the shell script:
https://github.com/todbot/blink1/blob/master/java/blink1-tool-java.sh
for an example of how to set up the various paths.

Also, if you are on Linux, you will probably need to rebuild libBlink1.so by doing a "make compile" and "make jar" in blink1/java

@meza
Copy link
Author

meza commented Feb 1, 2013

Hey,

Even the script does the same thing before and after rebuilding the so. :(

On 1 Feb 2013 19:51, "Tod E. Kurt" notifications@github.com wrote:

Hi Maza,
Take a look at the shell script:
https://github.com/todbot/blink1/blob/master/java/blink1-tool-java.sh
for an example of how to set up the various paths.

Also, if you are on Linux, you will probably need to rebuild libBlink1.so
by doing a "make compile" and "make jar" in blink1/java


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-13010925.

@todbot
Copy link
Owner

todbot commented Feb 1, 2013

The Java wrapper under Linux hasn't been tested very extensively. We would appreciate any insight from people who have experience with Java on Linux.

@meza
Copy link
Author

meza commented Feb 1, 2013

I'll happily help once we solve this :)

Marton Meszaros
+447523539825
www.meza.hu
skype: vsb-meza

(The email has been sent from my phone. I am on the go, so my reply time
may vary.)
On 1 Feb 2013 21:21, "Tod E. Kurt" notifications@github.com wrote:

The Java wrapper under Linux hasn't been tested very extensively. We would
appreciate any insight from people who have experience with Java on Linux.


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-13012189.

@fredg02
Copy link
Contributor

fredg02 commented Feb 8, 2013

Hi,
I've found a way to get this working:

  1. cd blink1/commandline/hidapi/libusb
  2. make -f Makefile.linux
  3. copy the newly created libhidapi-libusb.so to your lib dir
  4. export LD_LIBRARY_PATH=
  5. export LD_PRELOAD=/libhidapi-libusb.so
  6. run you java program

It's just a workaround and hopefully not needed once we figure how it's done the right way, but it works.

HTH,

Fred

@todbot
Copy link
Owner

todbot commented Feb 8, 2013

Thanks, Fred, this is extremely useful.
I haven't had to use LD_PRELOAD in like a decade, I forget how it's different from LD_LIBRARY_PATH

Which distro of Linux did you do this on?

@todbot
Copy link
Owner

todbot commented Feb 9, 2013

I updated the Java/Processing library zip bundle at:
http://thingm.com/blink1/downloads/blink1-java-processing-lib.zip
that should now out-of-the box for Linux.

If you are using this directly from java, just point your LD_LIBRARY_PATH and to the unzipped directory and add the blink1.jar to your jar path. On the command line, this looks something like:

unzip blink1-java-processing-lib.zip
export BLINK1LIB=`pwd`/blink1-java-processing-lib/blink1/library
java -Djava.awt.headless=true -Djava.library.path=${BLINK1LIB} ${BLINK1LIB}/blink1.jar MyTestClass

@todbot todbot closed this as completed Feb 9, 2013
@reiabreu
Copy link

reiabreu commented Feb 9, 2013

Hi, Tod. The new Java/Processing library zip worked for me. Thank you.

@fredg02
Copy link
Contributor

fredg02 commented Feb 9, 2013

I'm still running Kubuntu 10.04.04 LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants