The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » JAI

Thread: JAI on MAC

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 13 - Last Post: Jul 11, 2007 3:44 PM by: James Cheng
soulofhoops

Posts: 1
JAI on MAC
Posted: Feb 26, 2007 5:50 AM
  Click to reply to this thread Reply

Hi,
Can anybody tell me if its possible to run JAI 1.1.3 on MAC? if so then where to download it from!! I trying to run a java program on MAC which uses JAI but i am getting the following exception:

MAC Computer:~/JAI HCLImac$ java ConvertToJpeg AAAAZJO0.tiff Exception in thread "main" java.lang.ExceptionInInitializerError at ConvertToJpeg.main(ConvertToJpeg.java:23) Caused by: java.lang.RuntimeException: Registry initialization file not found. at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:357) at javax.media.jai.JAI.<clinit>(JAI.java:560) ... 1 more

Can some one help me with this error.

mltownsend

Posts: 1
Re: JAI on MAC
Posted: Feb 26, 2007 10:57 AM   in response to: soulofhoops
  Click to reply to this thread Reply

According to Sun's website it is supported. Check out:
http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html#mac

Brian Burkhalter
Re: [JAI] Re: JAI on MAC
Posted: Feb 26, 2007 1:42 PM   in response to: mltownsend
  Click to reply to this thread Reply

To be specific, supported by Apple:

http://www.apple.com/support/downloads/java3dandjavaadvancedimagingupdate.html
http://www.apple.com/downloads/macosx/apple/macosx_updates/java3dandjavaadvancedimagingupdate.html

On Mon, 26 Feb 2007, jai-interest@javadesktop.org wrote:

> According to Sun's website it is supported. Check out:
> http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html#mac
> [Message sent by forum member 'mltownsend' (mltownsend)]
>
> http://forums.java.net/jive/thread.jspa?messageID=205298
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


Fabrizio Giudici
Re: [JAI] Re: JAI on MAC
Posted: Feb 26, 2007 1:58 PM   in response to: Brian Burkhalter
  Click to reply to this thread Reply


On Feb 26, 2007, at 22:42 , Brian Burkhalter wrote:

> To be specific, supported by Apple:
>
> http://www.apple.com/support/downloads/
> java3dandjavaadvancedimagingupdate.html
> http://www.apple.com/downloads/macosx/apple/macosx_updates/
> java3dandjavaadvancedimagingupdate.html

Unfortunately Apple's JAI is not compatible with Mac OS X 10.4, which
happens to be the latest one. Furthermore, I'm not sure, I could be
wrong, but I don't think Apple's version is 1.1.3, since it dates
back to the end of 2003. Three years ago!

My experience is that I'm using Sun JAI on Mac OS X 10.4 and works
well (at least for what I'm doing); I've never seen the error message
notified by the poster. Maybe if he provides a test case, I could
give it a try.

PS Of course choosing Sun's implementation means to give up to native
libraries...


--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941


---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


mohammed_qaimari

Posts: 11
Re: [JAI] Re: JAI on MAC
Posted: Feb 26, 2007 3:06 PM   in response to: Fabrizio Giudici
  Click to reply to this thread Reply

HI...

There's no need to use the native libraries, in out project we used JAI (Sun's Impl)
on HP-UX and IBM AIX with problems, just get rid of the native wrappers and it will run as a pure Java extension.

Brian Burkhalter
Re: [JAI] Re: JAI on MAC
Posted: Feb 26, 2007 3:35 PM   in response to: mohammed_qaimari
  Click to reply to this thread Reply

I assume you intended "without problems".

Brian

On Mon, 26 Feb 2007, jai-interest@javadesktop.org wrote:

> HI...
>
> There's no need to use the native libraries, in out project we used JAI (Sun's Impl)
> on HP-UX and IBM AIX with problems, just get rid of the native wrappers and it will run as a pure Java extension.
> [Message sent by forum member 'mohammed_qaimari' (mohammed_qaimari)]
>
> http://forums.java.net/jive/thread.jspa?messageID=205351
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


rkolbe

Posts: 4
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 12:23 PM   in response to: Fabrizio Giudici
  Click to reply to this thread Reply

I have a similar problem, that is, I'm attempting to use jai on a mac... The specific use I have is to catalog images in a database, copying the image files into a specific location. The purpose is to be able to retrieve images using the keywords entered when cataloging them. This must work for CMYK as well as RGB files.

It works fine on my solaris system, but when I try similar code on the mac, I get several errors. The most confounding to me at the moment is the following (starting with my code):
FileSeekableStream stream = null;
try {
stream = new FileSeekableStream ( file );
} catch ( IOException ex )
ex.printStackTrace();
System.exit();
}

The statement that begins with "stream =" generates a stacktrace as follows:
java.io.FileNotFoundException: /Users (No such file or directory)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
at com.sun.media.jai.codec.FileSeekableStream.<init>(FileSeekableStream.java:86)
at ... this identifies the line in my program above (starts with stream =).

I read this thread and think that it may point me in the right direction, but I'm uncertain about where to find the wrapper files on the mac, and in fact, I don't even have the jai files in the usual place, $JAVA_HOME/jre/lib/ext, so I don't understand how to incorporate the correct sun files and remove the offending mac files.

Any help would be appreciated.

Brian Burkhalter
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 1:12 PM   in response to: rkolbe
  Click to reply to this thread Reply

The trace indicates that the file cannot be found so I don't know that this is
a system issue. The JAI jar files overlay the JVM in any case so you should
not have to tweak the latter AFAIK.

On Tue, 10 Jul 2007, jai-interest@javadesktop.org wrote:

> I have a similar problem, that is, I'm attempting to use jai on a mac... The specific use I have is to catalog images in a database, copying the image files into a specific location. The purpose is to be able to retrieve images using the keywords entered when cataloging them. This must work for CMYK as well as RGB files.
>
> It works fine on my solaris system, but when I try similar code on the mac, I get several errors. The most confounding to me at the moment is the following (starting with my code):
> FileSeekableStream stream = null;
> try {
> stream = new FileSeekableStream ( file );
> } catch ( IOException ex )
> ex.printStackTrace();
> System.exit();
> }
>
> The statement that begins with "stream =" generates a stacktrace as follows:
> java.io.FileNotFoundException: /Users (No such file or directory)
> at java.io.RandomAccessFile.open(Native Method)
> at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
> at com.sun.media.jai.codec.FileSeekableStream.<init>(FileSeekableStream.java:86)
> at ... this identifies the line in my program above (starts with stream =).
>
> I read this thread and think that it may point me in the right direction, but I'm uncertain about where to find the wrapper files on the mac, and in fact, I don't even have the jai files in the usual place, $JAVA_HOME/jre/lib/ext, so I don't understand how to incorporate the correct sun files and remove the offending mac files.
>
> Any help would be appreciated.
> [Message sent by forum member 'rkolbe' (rkolbe)]
>
> http://forums.java.net/jive/thread.jspa?messageID=226049
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


rkolbe

Posts: 4
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 3:01 PM   in response to: Brian Burkhalter
  Click to reply to this thread Reply

The file that is not found is /Users which the program received by my clicking on it in the filebrowser window which is a component of this software. The issue seems to be related to the FileSeekableStream, which is a jai class, which invokes the native method RandomAccessFile which then fails for some reason. It's not because the file doesn't exist (I only got as far as the first user interaction before this error), because first it's a directory and second, it does indeed exist.

I should add that this was working software on the mac, before adding jai in order to get the CMYK functionality. The modifications associated with incorporating jai led me to use FileSeekableStream in order to read in the cmyk file contents.

rkolbe

Posts: 4
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 3:16 PM   in response to: Brian Burkhalter
  Click to reply to this thread Reply

Actually, the point is that I don't understand the structure and utilization of java on the mac. So a previous post stated that the mac wrappers should be removed and the sun jai used. But I can't locate the place to put the sun jai jars. It already seems to be finding jai classes, and I haven't placed the jars in the usual place. And I don't know where to look for native wrapper classes, nor do I know which ones should be removed, even if I could find them

Essentially, I'm a unix guy trying to fnd my way around java on the mac. So allow me to succinctly state my questions:
1) Where do I place the sun files?
2) Do I use the standard set (jai_core.jar, jai_codec.jar) which I have on my Solaris machine?
a) And what about mlibwrapper_jai.jar? Is that a sun/solaris native wrapper for jai classes?
3) Where do I find the wrapper classes which need to be removed?
4) Which files are those wrapper classes? On my solaris machine it appears to be libmlib_jai.so and/or mlibwrapper_jai.jar.
5) Finally, doesn't the mac HAVE to use it's own wrapper classes for file access?

James Cheng
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 3:33 PM   in response to: rkolbe
  Click to reply to this thread Reply

On 2007/07/10 03:16 PM, jai-interest@javadesktop.org wrote:
> Actually, the point is that I don't understand the structure and utilization of java on the mac. So a previous post stated that the mac wrappers should be removed and the sun jai used. But I can't locate the place to put the sun jai jars. It already seems to be finding jai classes, and I haven't placed the jars in the usual place. And I don't know where to look for native wrapper classes, nor do I know which ones should be removed, even if I could find them
>
> Essentially, I'm a unix guy trying to fnd my way around java on the mac. So allow me to succinctly state my questions:
> 1) Where do I place the sun files?

You might have to put them at /System/Library/Java/Extensions/.
The files from Apple installed there seem to take precedence, so
you might have to replace files there, or uninstall Apple's JAI.
I am not sure how to uninstall JAI on Mac. If you can do that
then you might be able to install JAI 1.1.3 anywhere pointed to
by your CLASSPATH.

> 2) Do I use the standard set (jai_core.jar, jai_codec.jar) which I have on my Solaris machine?
> a) And what about mlibwrapper_jai.jar? Is that a sun/solaris native wrapper for jai classes?

mlibwrapper_jai.jar is a wrapper for the native library. The jar file
should be the same for all platform in theory, but Apple might have
their own version. The native libraries are platform specific.

> 3) Where do I find the wrapper classes which need to be removed?

/System/Library/Java/Extensions/

libmlib_jai.jnilib is the native library. Sun doesn't have a native
library for Mac OS X for JAI 1.1.3 at this time, so if you want to use
JAI 1.1.3 then you will have to use the pure Java version of JAI. You
might have to remove the native library and mlibwrapper_jai.jar to
avoid any possible conflict caused by a version mismatch.

> 4) Which files are those wrapper classes? On my solaris machine it appears to be libmlib_jai.so and/or mlibwrapper_jai.jar.

/System/Library/Java/Extensions/mlibwrapper_jai.jar wrapper classes
/System/Library/Java/Extensions/libmlib_jai.jnilib native library

> 5) Finally, doesn't the mac HAVE to use it's own wrapper classes for file access?

See answer to 2).

> [Message sent by forum member 'rkolbe' (rkolbe)]
>
> http://forums.java.net/jive/thread.jspa?messageID=226072

HTH,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


James Cheng
Re: [JAI] Re: JAI on MAC
Posted: Jul 10, 2007 4:31 PM   in response to: James Cheng
  Click to reply to this thread Reply

On 2007/07/10 03:33 PM, James Cheng wrote:
>> 3) Where do I find the wrapper classes which need to be removed?
>
> /System/Library/Java/Extensions/

As Brian pointed out, if you don't want to remove the old files
you can do something like this:

java -Djava.ext.dirs=<some_dir> YourApp

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net


rkolbe

Posts: 4
Re: [JAI] Re: JAI on MAC
Posted: Jul 11, 2007 3:16 PM   in response to: James Cheng
  Click to reply to this thread Reply

Thanks for providing the mac details. Unfortunately, it didn't improve my situation. I still have the same problem. Here are the details:

com.sun.media.jai.codec.FileSeekableStream invokes
java.io.RandomAccessFile which is in src.jar (which is found in the directory /System/Library/Frameworks/JavaVM.Framework/Versions/1.5.0/Home/)

The specific line of code in RandomAccessFile seems innocuous enough: open(name, imode).

I should point out another issue that may (or may not) be relevant to this. I also noticed on the mac that I get an error on startup of the code containing jai. That error is:

run:
2007-07-11 14:47:08.999 java[321] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0xf303, name = 'java.ServiceProvider'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2007-07-11 14:47:09.000 java[321] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)

Unfortunately, the identified file/directory structure (/usr/include/servers/bootstrap_defs.h) doesn't exist. If I remove the jai code, this message does not appear. I looked around at the apple site and found this:

>Looking at the errors, I think this is a known OS problem. If you create a ServerSocket before >loading the AWT in headless mode, the application will die.

>The workaround is to start up the AWT first by creating a java.awt.Dimension(), or >Toolkit.getDefaultToolkit(), then start listening for connections. I don't know enough about >Tomcat to know if that's even feasible, but that's the best we have right now.

I tried that but it didn't make a difference. In any case, my application will sometimes run on the mac, until I get to the point of selecting a file, at which point I get a stack trace.

You have said that I can avoid the mac native code, but I have yet to find a way to avoid this method (RandomAccessFile), which consistently fails. Obviously I could go back to Java2d and use other means (than FileSeekableStream) to read the file, but then I wouldn't have the CMYK ability that caused me to go to jai in the first place.

Is there an alternative? That is, can I copy the codecs and go back to java2d, install those codecs and read cmyk images?

If there's a way to avoid this method invocation (RandomAccessFile), or an alternative that I could use to get my cmyk images in a scrollable pane, please let me know. Thanks.

James Cheng
Re: [JAI] Re: JAI on MAC
Posted: Jul 11, 2007 3:44 PM   in response to: rkolbe
  Click to reply to this thread Reply

> You have said that I can avoid the mac native code, but I have yet to find a
> way to avoid this method (RandomAccessFile), which consistently fails.
> Obviously I could go back to Java2d and use other means (than
> FileSeekableStream) to read the file, but then I wouldn't have the CMYK
> ability that caused me to go to jai in the first place.

I was talking about avoiding the native code coming from JAI. But your
problem seems to be in Apple's implementation of JRE, which you can not
avoid, I guess, if you keep using JAI's JPEG codec.

> Is there an alternative? That is, can I copy the codecs and go back to
> java2d, install those codecs and read cmyk images?
>
> If there's a way to avoid this method invocation (RandomAccessFile), or an
> alternative that I could use to get my cmyk images in a scrollable pane,
> please let me know. Thanks.

Have you tried the new Java Image I/O?
http://java.sun.com/j2se/1.4.2/docs/guide/imageio/index.html

It seems to support JPEG images in CMYK format, according to this page:
http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html

There is also the JAI Image I/O Tools, https://jai-imageio.dev.java.net/,
which provides more plugins. But its JPEG plugin needs a native library
which is currently not available on Mac.

HTH,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net





 XML java.net RSS