Jump to content
Excelsior Forums
sbeckett

JAI and ImageIO support not working

Recommended Posts

I have created a natively-compiled package using JET, but when I run the program it complains that it cannot find the JAI and ImageIO classes it needs.

I ran the JET setup utility and added a new JET Profile, based on the 1.5.0_04 JDK.

I then specificed the four jar files that are added to the JRE JVM by the JAI and ImageIO installers.

I then made that the active JET Profile and ran the native compile.

When I launch my app, I get these sorts of stack traces:

    java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax.imageio.ImageIO

Perhaps it's because there are DLL files installed by the JAI and ImageIO packages that aren't included in the JET JVM?

There appears to be no way to add to the JET JVM the DLLs that those two packages install to JVM_HOME\bin. I assume that's why the compiled executable is choking on finding the classes it needs?

Do I need to get the mlib_jai.dll, mlib_jai_mmx.dll, clib_jiio.dll and possibly the checkmmx.exe files into the JET JVM?

Share this post


Link to post
Share on other sites

So now I understand I don't want to use the JET Profile override to use JAI and ImageIO.

Instead I just need the jar and dll files in the resource directory when I compile the app?

Share this post


Link to post
Share on other sites

JAI is not included in the list of allowed Endorsed Standards given at

http://java.sun.com/j2se/1.5.0/docs/guide/standards/

Thus, you may not specify the JAI jars as endorsed when creating a JET profile.

----------------

To optimize JAI with Excelsior JET, choose the CLASSPATH installation option on the JAI download page

http://java.sun.com/products/java-media/jai/downloads/download-1_1_2.html

and add the jars from the JAI installation directory to the "Classpath entries" pane of the JET Control Panel.

Then, add your application's jars to the pane and compile your application.

------------

Do I need to get the mlib_jai.dll, mlib_jai_mmx.dll, clib_jiio.dll and possibly the checkmmx.exe files into the JET JVM?

It's enough to place these native method DLLs into any directory listed in PATH. Another way is to place them into the current directory, i.e. that where the resulting executable resides.

These rules are not specific to Excelsior JET - that's a standard way of native method DLLs lookup on the Java platform.

---------------------------

Quick notes on preparing the installation for deployment to target systems:

1) As the JAI jars has been compiled into the executable, you do not need to deploy them

2) Native method DLLs have to be distributed along with the compiled application so add them to package files in the JetPackII deployment wizard.

The simplest way is to put the JAI DLLs and the compiled executable together in the same folder.

If it's not desirable for some reason, the installation tool you use, has to modify PATH on the target system appropriately or copy the DLLs into a directory definitely listed in PATH.

Share this post


Link to post
Share on other sites

I tried to use the above configuration and I got the following exception:

java.lang.SecurityException: sealing violation: package javax.media.jai is sealed

        at java.net.URLClassLoader.defineClass(Unknown Source)

        at java.net.URLClassLoader.<unknown>(Unknown Source)

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.security.AccessController.<unknown>(Unknown Source)

        at java.net.URLClassLoader.findClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

        at java.lang.ClassLoader.<unknown>(Unknown Source)

        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

        at java.lang.Class.forName(Unknown Source)

        at javax.media.jai.ParameterListDescriptor$1.class$(Unknown Source)

        at javax.media.jai.ParameterListDescriptor.<clinit>(Unknown Source)

        ... 7 more

Share this post


Link to post
Share on other sites

To make the app running on Sun JVM, did you copy the JAI's jars, property files and native method DLLs to the JRE/lib (JRE/bin) or added them to the application classpath explicitly?

Share this post


Link to post
Share on other sites

I used the default installation which copy the JARs and DLLs to the JRE/lib, JRE/bin.

but when I created the bin with excelsior, I used the JARs in the in the class path.

Share this post


Link to post
Share on other sites

I tried to run the JAI demo with Excelsior, the problem didn't appear and the demo works fine.

The main difference between the demo and my application, is that I am adding JAI operation and imageIO reader/writer.

Those operators are registered using JAI and imageIO registry files. those files are located in the jar file at

META-INF\registryFile.jai

META-INF\services\javax.imageio.spi.ImageReaderSpi

META-INF\services\javax.imageio.spi.ImageWriterSpi

Share this post


Link to post
Share on other sites

Unfortunately, this information is not enough to reproduce the misbehavior :(

I created a small test that contains a custom image reader with a provider registered in registryFile.jai file. It works just fine -- the provider data is read from registry file with Excelsior JET 4.8 as well as with Sun JRE, and the image reader is successfully created.

Is it possible for you to send us a working sample that reproduces the problem?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×