[sane-devel] JNI code for SANE

Vacuum Joe vacuumjoe at yahoo.com
Thu Jan 26 18:39:10 UTC 2006

 Could you explain for java-impaired people like me what jni is, how it
is connected to java and how your project is different to the other
java projects? There is already code that comes with SANE
(sane-backends/japi), there is jsane (commercial,
http://asprise.com/product/jsane/index.php) and morena
 JNI = Java Native Interface.  Quick summary: Everything within Java runs in a virtual machine.  No Java program has access to memory, and it also cannot call libraries or do any real machine-level stuff.  This is why Java is so stable and secure: programs can't stomp on memory or do anything else that is not allowed by the JVM and the JVM's security policies.  The only way Java can interact with the real hardware is through the interfaces provided by the Java Virtual Machine (JVM).  In some cases, this is too confining, like if you need to interface to a library.  The SANE library is just such a library.  In this case, the Java Native Interface can be used.  It allows you to write code in C (or C++, etc) and have the JVM dynamically link the library in, and then the Java code can call out to the library.  What I have done is use JNI to wrap the SANE library so I can access SANE from within Java.
 This is very similar to Morena.  I think it is similar to jsane, except jsane only works with network scanners (I may be wrong on that).  The difference is that we can release this under GPL because we don't anticipate trying to sell this code as its own product.
 As for japi in the SANE backends, yes, this is very similar to that, except that code is about 9 years old and doesn't seem to be maintained.  Java has changed a lot in 9 years.  Unless there is some reason not to, it makes sense to remove japi from sane-backends.
 There are some possibilities to include such a project into SANE: 

1) Place it in sane-backends. There you have CVS and it would come
   with every sane-backends installation. However this only makes
   sense if it is widely used and maintained. For this reason I
   already thought about removing japi from sane-backends beacuse its
   unmaintained and doesn't seem to be used.
 It really belongs in the front-ends I believe.  There seem to be requests and commercial products that do the same thing, so I think there is interest.  Obviously japi is no longer maintained and is not really set up for modern Java use.  For example japi can't do something simple like scan and save as a JPEG.  My code can.  Also my company will sponsor maintenance of the code, with the hope that SANE will just put a simple small link to the company site.
 There are some good advantages for this.  In the future, we could have an alternative to xscanimage that is written in Java.  This would have have advantages in terms of stability, ease of use, and ability to easily integrate into other Java apps.  Java is starting to make an entrance into the Linux desktop world.  As you may know, gcc now has a powerful and capable Java compiler, called gcj, so it is now possible to compile Java applications into native binaries and run them just like any other program, without needing a JVM at all.  Also Trolltech is releasing an official Qt binding for Java, so we could have a full Qt/KDE scanner application in Java using this code.  Java is becoming a bigger part of the Linux desktop.
 Until now I only mention Debian's and redhat's contributions
explicitely, but explicitely mentionning the company/person who wrote
the code isn't a problem.
 Ah, that is good.  Actually we ideally would like a HTML link.  They will sponsor maintenance and answer questions on it.
 Including into SANE really needs a maintainer, however. So either you
must manintain it also in future or we must wait for somebody else who
volunteers to do so.
 We'll do it.
 Your other mails don't seem to contain any links, maybe this is
because I use a non-graphical mail program?
 Yes.  I'm using this crazy Yahoo JavaScript mail client which seems more frustrating than helpful.  Here's the URL: http://chiralsoftware.net/scanner/applet.html .  Hopefully that will get through.  If not, it's chiralsoftware dot net slash scanner slash applet.html

Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20060126/c7817354/attachment.htm

More information about the sane-devel mailing list