[sane-devel] Java API (japi) Changes

Henning Meier-Geinitz henning@meier-geinitz.de
Fri, 31 Oct 2003 10:58:31 +0100


Hi,

sorry for the late response. I hoped someone else would answer :-)

On Fri, Oct 24, 2003 at 03:08:58PM -0500, Chris Chesney wrote:
> We've created a beta version of a web-based document management
> system that we hope to provide as an open source solution if the
> product matures. 

Ah, sound nice.

> The solution is Java based and our intent was to
> use the JNI wrappers provided in the japi directory as means to
> control the backend scanning.  We're learning as we go, but this is
> what we've done so far:

Thanks for the comments. Unfortunetely I don't know anything about
java and I'm not even able to run "make" in japi/. Well I am, but it
doesn't work:

| javac Sane.java
| javah -jni Sane
| couldn't find class SaneOption
| couldn't find class SaneParameters
| make: *** [Sane.h] Fehler 1

After setting classpath to . :

| javac --classpath . Jscanimage.java
| Jscanimage.java:715: Warnung: Discouraged redundant use of public'
| modifier in declaration of abstract method setFromControl'.
|        public void setFromControl();	   // Ask SANE control for
|        current value.
|        ^
| Jscanimage.java:68: error: Class or interface
| com.sun.java.swing.event.ChangeListener' not found in import.
|    import com.sun.java.swing.event.ChangeListener;
|           ^
| Jscanimage.java:95: error: Type JButton' not found in declaration of
| field scanButton'.
|        private JButton scanButton, previewButton;
|                ^
| Jscanimage.java:0: confused by earlier errors, bailing out

Well, I'm using gcj et al, maybe that just doesn't work or I'm missing
something.

> 1.  Fixed a bug in Sane.c - Line 268 should be   
> jclass stringClass = (*env)->FindClass(env, "java/lang/String");
> *NOT*
> jclass stringClass = (*env)->FindClass(env, "String");

Ok.

> 2.  Added a package statement to the following 5 java classes.  For
> our purposes, I called the package japi.  It would be more
> appropriate to follow the typical package naming convention and would
> ask for a suggestion from you if you want this committed to the
> project.
>
> - SaneDevice.java
> - SaneOption.java
> - SaneParameters.java
> - SaneRange.java
> - Sane.java

No idea. What is the "typical package naming convention"? The pacakge
containing the java api is called "sane-backends". Maybe we should
split the japi stuff from sane-backends anyway.

> 3.  By making these files part of a package, Sane.c requires an
> additional change to make the object references fully qualified.

Well, as I said I have no idea about the details of Java. So I ask
anyone with some experiences with java to just send a patch (and an
update of the documentation) to get it working :-)

> We haven't done anything with the Swing app that is included in the
> japi directory because we lack the experience in Swing and it isn't
> necessary for the project we're working on.  If your interested in
> separating the wrapper code from the example java apps, we're almost
> there and would be happy to work with you to get it committed.

That sounds reasonable. Patches are welcome. But that's stuff for
after the release of sane-backends 1.0.13.

> if you were looking for more of a complete overhaul of the entire
> directory, we're probably not up for the challenge. 

I'd appreciate if I could just run "make" and everything would work
out-of-the-box. Well, maybe with the appropriate java development kit
installed it would...

Bye,
  Henning