I am trying to access the JMuPDF java library from jruby and am having
some trouble. As I am not a Java expert and only have a little
experience accessing java functionality from jruby I was hoping someone
could point out what I am doing wrong.
The JMuPDF library can be found here:
The JMuPDF tutorial I am trying to port to JRuby along with the error
can be read here: Directory contents · GitHub
Requiring the jar file causes no trouble ; it is when I try to actually
use the Java classes that things go wrong.
I have used the same setup with iText without trouble so I am not sure
why it is failing with this one.
Could anyone point out what I am doing wrong? If anyone has any examples
of using JMuPDF from JRuby I would be grateful if they could be shared.
Actually, since he was using the com.jmupdf.PdfDocument inline he does
not need to do an import (although it is never a bad practice). This
sort of error is usually from one of two things:
Dependent jar on the library you are using is not in the CLASSPATH
You are using some native library that needs java.library.path set.
Thanks for the suggestions. I should have tried the -d option earlier
but my mind tends to turn off once I am out of ruby-land. I have added
the full output of that command to the gist at
Not sure if it is important but the directory I am adding to the
java.library.path has two .so files in it. One for 32bit
(libjmupdf32.so) and one for 64 bit operating systems (libjmupdf64.so),
I am currently on a 64bit Linux.
Apologies for dragging up an old thread but I haven’t been able to make
any progress on this and thought I would ask again since my last email
included new information (output from the -d option for a full stack
trace).
I don’t suppose there are any Java guys in the room willing to give it
another look?
Which, as far as I have read, should make sure that the .so file in that
directory is being picked up. However the same error is still appearing.
If it is indeed a problem loading the .so, it could be due to JRuby
itself being loaded into the bootstrap classloader. Can you run the
same test with -d? We may be able to get more information out of the
load process, such as the actual error it’s getting loading the class
in question.
Charlie
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.