Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

Unable to launch...

Discussion about Steve DeVore's Book Scan Wizard, a power-user package to automate scan processing.
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Unable to launch...

Post by rob » 15 Mar 2011, 20:40

I cleared the Java cache, downloaded the JNLP file fresh, and got an InvocationTargetException trying to launch.

The launch file:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://bookscanwizard.sourceforge.net/run" href="bsw.jnlp" spec="1.0+">
    <information>
        <title>Book Scan Wizard</title>
        <vendor>Steve Devore</vendor>
        <homepage href="http://bookscanwizard.sourceforge.net"/>
        <description>Book Scan Wizard</description>
        <description kind="short">Book Scan Wizard</description>
        <association extensions="bsw" mime-type="application-x/bsw-file"/>
        <shortcut online="false">
          <desktop/>
          <menu submenu="Book Scan Wizard"/>
        </shortcut>
        <offline-allowed/>

    <icon href="bsw.png" kind="default"/>
</information>
<update check="timeout" policy="prompt-update"/>
<security>
<all-permissions/>
</security>
    <resources>
<j2se java-vm-args="-Xmx1024M" version="1.6+"/>
<jar href="BookScanWizard.jar" main="true"/>
<extension href="http://download.java.net/media/jai/webstart/release/jai-1.1.3-latest.jnlp" name="" version=""/>
<extension href="http://download.java.net/media/jai-imageio/webstart/release/jai-imageio-1.1.jnlp" name="" version=""/>
</resources>
    <application-desc main-class="net.sourceforge.bookscanwizard.BSW">

    </application-desc>
</jnlp>
The exception:

Code: Select all

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.javaws.Launcher.executeApplication(Launcher.java:1904)
	at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1842)
	at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1604)
	at com.sun.javaws.Launcher.run(Launcher.java:138)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ExceptionInInitializerError
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
	at net.sourceforge.bookscanwizard.OperationList.<init>(OperationList.java:102)
	at net.sourceforge.bookscanwizard.MainFrame.<init>(MainFrame.java:366)
	at net.sourceforge.bookscanwizard.BSW.<init>(BSW.java:223)
	at net.sourceforge.bookscanwizard.BSW.main(BSW.java:176)
	... 9 more
Caused by: java.util.NoSuchElementException
	at javax.imageio.spi.FilterIterator.next(ServiceRegistry.java:808)
	at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:816)
	at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:801)
	at net.sourceforge.bookscanwizard.op.CreateArchiveZip.<clinit>(CreateArchiveZip.java:52)
	... 19 more
When I try to run the manual install, I get the same thing:

Code: Select all

Exception in thread "main" java.lang.ExceptionInInitializerError
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at net.sourceforge.bookscanwizard.OperationList.<init>(OperationList.java:102)
        at net.sourceforge.bookscanwizard.MainFrame.<init>(MainFrame.java:366)
        at net.sourceforge.bookscanwizard.BSW.<init>(BSW.java:223)
        at net.sourceforge.bookscanwizard.BSW.main(BSW.java:176)
Caused by: java.util.NoSuchElementException
        at javax.imageio.spi.FilterIterator.next(ServiceRegistry.java:808)
        at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:816)
        at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:801)
        at net.sourceforge.bookscanwizard.op.CreateArchiveZip.<clinit>(CreateArchiveZip.java:52)
        ... 10 more
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: Unable to launch...

Post by rob » 15 Mar 2011, 21:04

Sorry, I should have mentioned I'm on OSX. It's possible that Apple only supplies JAI 1.1.2, since I found jai_core.jar under /System/Library/Java/Extensions, and the META-INF/MANIFEST.MF file from there shows version 1.1.2.

I think there is a 1.1.3 non-native pure Java floating around on jai.dev.java.net, but they seem to having one of their regular website outages right now :/
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Unable to launch...

Post by steve1066d » 15 Mar 2011, 22:20

Here's the super-secret location of the 1.1.3 binaries:

http://download.java.net/media/jai/buil ... ase/1_1_3/

And for the jai-imageio:

JAI ImageIO 1.1:
http://download.java.net/media/jai-imag ... lease/1.1/

Let me know if the 1.1.3 version helps.. I had to tweak something for the jp2 downloads to work around a bug.. but that might have exposed another bug...
Steve Devore
BookScanWizard, a flexible book post-processor.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Unable to launch...

Post by steve1066d » 16 Mar 2011, 00:54

I checked with another person who's running OSX, and he's having problems too. I've checked in a fix that may help the issue. Give it another try.
Steve Devore
BookScanWizard, a flexible book post-processor.

User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: Unable to launch...

Post by rob » 16 Mar 2011, 10:42

Grr. I tried 1.1b, same problem.

I downloaded the platform-independent version of JAI 1.1.3, and ran BSW:

Code: Select all

$ java -classpath BookScanWizard.jar:../../jai-1_1_3/lib/jai_core.jar:../../jai-1_1_3/lib/jai_codec.jar -Xmx1024M  net.sourceforge.bookscanwizard.BSW

Exception in thread "main" java.lang.ExceptionInInitializerError
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at net.sourceforge.bookscanwizard.OperationList.<init>(OperationList.java:102)
        at net.sourceforge.bookscanwizard.MainFrame.<init>(MainFrame.java:366)
        at net.sourceforge.bookscanwizard.BSW.<init>(BSW.java:223)
        at net.sourceforge.bookscanwizard.BSW.main(BSW.java:176)
Caused by: java.lang.NullPointerException
        at net.sourceforge.bookscanwizard.op.CreateArchiveZip.<clinit>(CreateArchiveZip.java:62)
        ... 10 more
So no luck there. I couldn't find a platform-independent version of ImageIO. If only java.net were alive, I could try downloading the source and compiling...

In any case, you know my problem with JAI. It looks like you're trying to zip some files. If you're creating a JAI operation to zip files, maybe instead you can use java.util.zip?

Correction: this is because of ImageIO, which I apparently don't have (and can't get).
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: Unable to launch...

Post by rob » 16 Mar 2011, 11:24

OK, there appears to be some hope. Doing an immense amount of Googling, I got the impression that you could actually download any of the ImageIO packages (linux, windows, or sun), unzip it, find the jai_imageio.jar file, and include that in the classpath. Apparently ImageIO will fall back to a platform-independent version of JPEG2000 if it can't find a native version.

So I tried this:

Code: Select all

$ java -classpath BookScanWizard.jar:../../jai-1_1_3/lib/jai_core.jar:../../jai-1_1_3/lib/jai_codec.jar:../../jai_imageio.jar -Xmx1024M  net.sourceforge.bookscanwizard.BSW

CreateArchiveZip Could not find proper writer.  Using: com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriter
But BSW did start up! I'll try to run through a book and see what happens.
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Unable to launch...

Post by steve1066d » 16 Mar 2011, 11:34

Cool..I'm glad you got that working.

Here's the source code for jai-imagio (which you probably dont' need anymore):
http://java.net/projects/jai-imageio-core/sources

But the situation with java.net is really a mess.

Yeah... working JAI in BSW has been a challenge. I keep running into bugs with jai and jai-images. For the most part it is possible to work around the problems I'm finding, but it is time consuming. I do think its the best thing out there for image manipulation in java (as sad as that is).

I'm not using jai to create a zip.. I'm using it to write out the image to a stream that goes to a zip file. Unfortunately, where it is failing is just finding a jpeg2000 writer. I'm guessing that the version that is getting installed on OSX doesn't have that writer.

I'm thinking I might have to release a java-only version of BSW for OSX that has a self-contained jai and jai-images.

I'll take a look tonight and see if I can't figure some workaround.
Steve Devore
BookScanWizard, a flexible book post-processor.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Unable to launch...

Post by steve1066d » 16 Mar 2011, 19:50

Rob,

Was there an older version of jai_imageio.jar installed somewhere else?

You can try using the -verbose:class option when starting the app (don't list it on the classpath).

Its really weird. I verified that the missing files are in the webstart imageio-jar file, so I'm not sure why it is failing to find it.
Steve Devore
BookScanWizard, a flexible book post-processor.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Unable to launch...

Post by steve1066d » 16 Mar 2011, 21:10

Ok.. I think I figured it out.. Evidently OSX requires ImageIO.scanForPlugins() to work right.

Write once, run anywhere... yeah.

Anyways, I've updated the code to 1.1c to fix this issue.

Edit: Just heard from a mac user that it indeed fixed the problem.
Steve Devore
BookScanWizard, a flexible book post-processor.

User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: Unable to launch...

Post by rob » 17 Mar 2011, 15:13

I have an idea to bypass that thing that looks like it came out of my nose during a particularly bad cold -- what's it called? Oh yeah, the JAI :mrgreen: -- completely while making the program even more portable and possibly faster. Sounds too good to be true? It's possible, which is why I want to fiddle around with the BSW source a little more before claiming victory.
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest