Skip to main content

[JAI-IMAGEIO] How to run jai-imageio with source code

7 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Nidel, Mike

Here's what I normally do in Eclipse to get around this:

Build a jar file with the correct file in META-INF/services
as in jai_imageio.jar. You can even use the jai_imageio.jar
if you want.

Put this jar file on the classpath of your debug launcher,
ALL THE WAY AT THE BOTTOM. It needs to be below the entry
for your project code. This way any changes made to your
code will be picked up, before the classes in the jar file.
But META-INF/services/javax.imageio.spi.ImageReaderSpi will
still be on the classpath for the plugin to be picked up.

You could probably also just build a path in your project
called src/META-INF/services and put the right files in there
and eclipse will automatically copy them to the classpath,
similar to what Robert suggested.

Hope that helps.

> -----Original Message-----
> From: robert engels [mailto:rengels@ix.netcom.com]
> Sent: Thursday, April 17, 2008 6:34 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] How to run jai-imageio with source code
>
> To clarify, the reason being is that the JAR file classloader
> is not used - it is using the classpath classloaader.
>
> It may work if you configure eclipse to copy these files to
> the output path (and then the classpath classloader should be
> able to find them).
>
> On Apr 17, 2008, at 5:31 PM, robert engels wrote:
>
> > It doesn't work because it can't find the
> 'META-INF/services/ XXXXXX'
> > files to register the service providers.
> >
> > The best way seems to manually register the providers using
> > IIORegistry.registerServiceProvider();
> >
> > On Apr 17, 2008, at 3:44 PM, Shih-gian Lee wrote:
> >
> >> ---------- Forwarded message ----------
> >> From: "Lee, Shih-Gian"
> >> Date: Thu, 17 Apr 2008 16:23:13 -0400 Hello jai users/developers,
> >>
> >> I used jai-imageio jar to merge some tiff files recently. All is
> >> well.
> >> But, it is a little bit slow. So, I downloaded the source
> and would
> >> like to run it locally to debug. I have my project
> reference the jai
> >> project but my project still could not find the implementation
> >> source. When I include the jar to my classpath, all is well.
> >>
> >> I am using eclipse and run my code through JUnit test case.
> >>
> >> Any guidance you can provide me is much appreciated.
> >>
> >> Thanks,
> >> Lee
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> >> For additional commands, e-mail: interest-help@jai-
> >> imageio.dev.java.net
> >>
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail: interest-help@jai-
> > imageio.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

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

Shih-gian Lee

Hi Mike,

Thank you for your respond.

I went for the easier route by creating a path called src/META-INF/services
in my project. It managed to find the implementation classes.

However, I encountered another minor problem. The source could not find the
vendor name through reflection:

sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi:
Provider com.sun.media.imageioimpl.stream.ChannelImageOutputStreamSpi could
not be instantiated: java.lang.IllegalArgumentException: vendorName == null!

Any advice you can provide is much appreciated!

Thanks,
Lee

On Fri, Apr 18, 2008 at 9:03 AM, Nidel, Mike wrote:

> Here's what I normally do in Eclipse to get around this:
>
> Build a jar file with the correct file in META-INF/services
> as in jai_imageio.jar. You can even use the jai_imageio.jar
> if you want.
>
> Put this jar file on the classpath of your debug launcher,
> ALL THE WAY AT THE BOTTOM. It needs to be below the entry
> for your project code. This way any changes made to your
> code will be picked up, before the classes in the jar file.
> But META-INF/services/javax.imageio.spi.ImageReaderSpi will
> still be on the classpath for the plugin to be picked up.
>
> You could probably also just build a path in your project
> called src/META-INF/services and put the right files in there
> and eclipse will automatically copy them to the classpath,
> similar to what Robert suggested.
>
> Hope that helps.
>
> > -----Original Message-----
> > From: robert engels [mailto:rengels@ix.netcom.com]
> > Sent: Thursday, April 17, 2008 6:34 PM
> > To: interest@jai-imageio.dev.java.net
> > Subject: Re: [JAI-IMAGEIO] How to run jai-imageio with source code
> >
> > To clarify, the reason being is that the JAR file classloader
> > is not used - it is using the classpath classloaader.
> >
> > It may work if you configure eclipse to copy these files to
> > the output path (and then the classpath classloader should be
> > able to find them).
> >
> > On Apr 17, 2008, at 5:31 PM, robert engels wrote:
> >
> > > It doesn't work because it can't find the
> > 'META-INF/services/ XXXXXX'
> > > files to register the service providers.
> > >
> > > The best way seems to manually register the providers using
> > > IIORegistry.registerServiceProvider();
> > >
> > > On Apr 17, 2008, at 3:44 PM, Shih-gian Lee wrote:
> > >
> > >> ---------- Forwarded message ----------
> > >> From: "Lee, Shih-Gian"
> > >> Date: Thu, 17 Apr 2008 16:23:13 -0400 Hello jai users/developers,
> > >>
> > >> I used jai-imageio jar to merge some tiff files recently. All is
> > >> well.
> > >> But, it is a little bit slow. So, I downloaded the source
> > and would
> > >> like to run it locally to debug. I have my project
> > reference the jai
> > >> project but my project still could not find the implementation
> > >> source. When I include the jar to my classpath, all is well.
> > >>
> > >> I am using eclipse and run my code through JUnit test case.
> > >>
> > >> Any guidance you can provide me is much appreciated.
> > >>
> > >> Thanks,
> > >> Lee
> > >>
> > >>
> > ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail:
> > interest-unsubscribe@jai-imageio.dev.java.net
> > >> For additional commands, e-mail: interest-help@jai-
> > >> imageio.dev.java.net
> > >>
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > interest-unsubscribe@jai-imageio.dev.java.net
> > > For additional commands, e-mail: interest-help@jai-
> > > imageio.dev.java.net
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail:
> > interest-help@jai-imageio.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>
[att1.html]

Nidel, Mike

The vendor name is a property stored in the jar file manifest:
Manifest.mf. Just like your services file must be in
src/META-INF/services, there should be a file src/META-INF/Manifest.mf.
This file is inside the jai_imageio.jar and you should also find it
somewhere in the source code distribution you downloaded. Copy it to
src/META-INF and this should solve your problem.

Mike

________________________________

From: Shih-gian Lee [mailto:shihgian@gmail.com]
Sent: Saturday, April 19, 2008 11:37 AM
To: interest@jai-imageio.dev.java.net
Subject: Re: [JAI-IMAGEIO] How to run jai-imageio with source
code

Hi Mike,

Thank you for your respond.

I went for the easier route by creating a path called
src/META-INF/services in my project. It managed to find the
implementation classes.

However, I encountered another minor problem. The source could
not find the vendor name through reflection:

sun.misc.ServiceConfigurationError:
javax.imageio.spi.ImageOutputStreamSpi: Provider
com.sun.media.imageioimpl.stream.ChannelImageOutputStreamSpi could not
be instantiated: java.lang.IllegalArgumentException: vendorName == null!

Any advice you can provide is much appreciated!

Thanks,
Lee

On Fri, Apr 18, 2008 at 9:03 AM, Nidel, Mike
wrote:

Here's what I normally do in Eclipse to get around this:

Build a jar file with the correct file in
META-INF/services
as in jai_imageio.jar. You can even use the
jai_imageio.jar
if you want.

Put this jar file on the classpath of your debug
launcher,
ALL THE WAY AT THE BOTTOM. It needs to be below the
entry
for your project code. This way any changes made to your
code will be picked up, before the classes in the jar
file.
But META-INF/services/javax.imageio.spi.ImageReaderSpi
will
still be on the classpath for the plugin to be picked
up.

You could probably also just build a path in your
project
called src/META-INF/services and put the right files in
there
and eclipse will automatically copy them to the
classpath,
similar to what Robert suggested.

Hope that helps.

> -----Original Message-----
> From: robert engels [mailto:rengels@ix.netcom.com]
> Sent: Thursday, April 17, 2008 6:34 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] How to run jai-imageio with
source code
>
> To clarify, the reason being is that the JAR file
classloader
> is not used - it is using the classpath classloaader.
>
> It may work if you configure eclipse to copy these
files to
> the output path (and then the classpath classloader
should be
> able to find them).
>
> On Apr 17, 2008, at 5:31 PM, robert engels wrote:
>
> > It doesn't work because it can't find the
> 'META-INF/services/ XXXXXX'
> > files to register the service providers.
> >
> > The best way seems to manually register the
providers using
> > IIORegistry.registerServiceProvider();
> >
> > On Apr 17, 2008, at 3:44 PM, Shih-gian Lee wrote:
> >
> >> ---------- Forwarded message ----------
> >> From: "Lee, Shih-Gian"
> >> Date: Thu, 17 Apr 2008 16:23:13 -0400 Hello jai
users/developers,
> >>
> >> I used jai-imageio jar to merge some tiff files
recently. All is
> >> well.
> >> But, it is a little bit slow. So, I downloaded the
source
> and would
> >> like to run it locally to debug. I have my project
> reference the jai
> >> project but my project still could not find the
implementation
> >> source. When I include the jar to my classpath, all
is well.
> >>
> >> I am using eclipse and run my code through JUnit
test case.
> >>
> >> Any guidance you can provide me is much
appreciated.
> >>
> >> Thanks,
> >> Lee
> >>
> >>
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> >> For additional commands, e-mail: interest-help@jai-
> >> imageio.dev.java.net
> >>
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail: interest-help@jai-
> > imageio.dev.java.net
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

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

[att1.html]

Shih-gian Lee

---------- Forwarded message ----------
From: "Lee, Shih-Gian"
Date: Thu, 17 Apr 2008 16:23:13 -0400
Hello jai users/developers,

I used jai-imageio jar to merge some tiff files recently. All is well.
But, it is a little bit slow. So, I downloaded the source and would
like to run it locally to debug. I have my project reference the jai
project but my project still could not find the implementation
source. When I include the jar to my classpath, all is well.

I am using eclipse and run my code through JUnit test case.

Any guidance you can provide me is much appreciated.

Thanks,
Lee

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

robert engels

It doesn't work because it can't find the 'META-INF/services/XXXXXX'
files to register the service providers.

The best way seems to manually register the providers using
IIORegistry.registerServiceProvider();

On Apr 17, 2008, at 3:44 PM, Shih-gian Lee wrote:

> ---------- Forwarded message ----------
> From: "Lee, Shih-Gian"
> Date: Thu, 17 Apr 2008 16:23:13 -0400
> Hello jai users/developers,
>
> I used jai-imageio jar to merge some tiff files recently. All is well.
> But, it is a little bit slow. So, I downloaded the source and would
> like to run it locally to debug. I have my project reference the jai
> project but my project still could not find the implementation
> source. When I include the jar to my classpath, all is well.
>
> I am using eclipse and run my code through JUnit test case.
>
> Any guidance you can provide me is much appreciated.
>
> Thanks,
> Lee
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

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

robert engels

To clarify, the reason being is that the JAR file classloader is not
used - it is using the classpath classloaader.

It may work if you configure eclipse to copy these files to the
output path (and then the classpath classloader should be able to
find them).

On Apr 17, 2008, at 5:31 PM, robert engels wrote:

> It doesn't work because it can't find the 'META-INF/services/
> XXXXXX' files to register the service providers.
>
> The best way seems to manually register the providers using
> IIORegistry.registerServiceProvider();
>
> On Apr 17, 2008, at 3:44 PM, Shih-gian Lee wrote:
>
>> ---------- Forwarded message ----------
>> From: "Lee, Shih-Gian"
>> Date: Thu, 17 Apr 2008 16:23:13 -0400
>> Hello jai users/developers,
>>
>> I used jai-imageio jar to merge some tiff files recently. All is
>> well.
>> But, it is a little bit slow. So, I downloaded the source and would
>> like to run it locally to debug. I have my project reference the jai
>> project but my project still could not find the implementation
>> source. When I include the jar to my classpath, all is well.
>>
>> I am using eclipse and run my code through JUnit test case.
>>
>> Any guidance you can provide me is much appreciated.
>>
>> Thanks,
>> Lee
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
>> For additional commands, e-mail: interest-help@jai-
>> imageio.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

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

sglee
Offline
Joined: 2008-04-07

HI Robert,

Thanks for the prompt respond. IIORegistry.registerServiceProvider(); is what I am looking for. I will give it a try.

Thanks!
Lee