Deal of the Day

Home » Main » Manning Forums » 2007 » Wicket in Action

Thread: JPEGImageEncoder?

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 7 - Pages: 1 - Last Post: May 29, 2009 12:14 PM by: Eelco12
satar

Posts: 32
From: California
Registered: 5/12/09
JPEGImageEncoder?
Posted: May 29, 2009 12:24 AM
  Click to reply to this thread Reply

First, I am assuming in listing 9.5 that Image is the wicket Image class as usual when choosing between the awt and the wicket instances that pop up in eclipse. However, I have yet to be able to figure out what I need to add to my Maven pom.xml file to get the JPEGImageEncoder and JPEGCodec classes that are used in this listing. By searching the internet I found the JCaptcha site and believe (beings even unusual imports are not mentioned in the book) that these are found in the "com.sun.image.codec.jpeg" package. I suppose I will eventually figure out how I can get these through a Maven dependency but if someone can point me in the right direction it sure would save me time!

Eelco12

Posts: 100
From: Seattle, Washington, USA
Registered: 11/12/05
Re: JPEGImageEncoder?
Posted: May 29, 2009 1:12 AM   in response to: satar in response to: satar
  Click to reply to this thread Reply

Yep, they are from 'com.sun.image.codec.jpeg'. Be careful using com.sun.* packages for real life situations.

satar

Posts: 32
From: California
Registered: 5/12/09
Re: JPEGImageEncoder?
Posted: May 29, 2009 10:23 AM   in response to: Eelco12 in response to: Eelco12
  Click to reply to this thread Reply

Eelco,

Very curious to why you heed a warning about the use of JPEG packages but currently even more curious to how the !@#$% I get them through a pom.xml dependency so that I can compile and run the example code from the book. I have skipped some of the minor examples but none of the harder ones because I want to be sure I understand what the book is telling me. I learn best (as most of us do) by exercising examples.

Eelco12

Posts: 100
From: Seattle, Washington, USA
Registered: 11/12/05
Re: JPEGImageEncoder?
Posted: May 29, 2009 10:58 AM   in response to: satar in response to: satar
  Click to reply to this thread Reply

From the JavaDoc of JPEGImageEncoder: * The JPEGImageEncoder interface can encode image data into interchange, * and abbreviated JPEG data streams that are written to the * OutputStream provided to the encoder. *

* Note that the classes in the com.sun.image.codec.jpeg package are not * part of the core Java APIs. They are a part of Sun's JDK and JRE * distributions. Although other licensees may choose to distribute these * classes, developers cannot depend on their availability in non-Sun * implementations. We expect that equivalent functionality will eventually * be available in a core API or standard extension. You don't need to do anything special to compile other than using a SUN JDK. Doesn't that work for you?

satar

Posts: 32
From: California
Registered: 5/12/09
Re: JPEGImageEncoder?
Posted: May 29, 2009 11:15 AM   in response to: Eelco12 in response to: Eelco12
  Click to reply to this thread Reply

No, not seeing them through eclipse but mine is wired to use JSE-1.5 libraries, which may be my problem. I may toy around with eclipse a bit and see if I can get these classes included and if not move on cause I currently don't have any use for Captcha and once I have my own need for included a third-party library I can try to extrapolate from the Captcha example. For example, I know I will be wanting to include JFreeChart generated images in the app I plan to use Wicket for.

Eelco12

Posts: 100
From: Seattle, Washington, USA
Registered: 11/12/05
Re: JPEGImageEncoder?
Posted: May 29, 2009 11:27 AM   in response to: satar in response to: satar
  Click to reply to this thread Reply

I'm using Eclipse with JDK 1.5 as well. On OSX leopard. I can use and open JPEGImageEncoder without problems (push shift+apple-t and type in JPEGImageEncoder).

satar

Posts: 32
From: California
Registered: 5/12/09
Re: JPEGImageEncoder?
Posted: May 29, 2009 11:54 AM   in response to: Eelco12 in response to: Eelco12
  Click to reply to this thread Reply

I am on a windows box, which may be the problem. Actually, when I inserted the import manually and then hovered over it, I got the following:

Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library

I think I will just skip past this example and go back to it when I have a different 3rd party example that I need for my project. No biggy... I am DIEING to get to chapter 13 where I can finally connect my examples to a database anyway :)

Thanks once again for the quick support!

Eelco12

Posts: 100
From: Seattle, Washington, USA
Registered: 11/12/05
Re: JPEGImageEncoder?
Posted: May 29, 2009 12:14 PM   in response to: satar in response to: satar
  Click to reply to this thread Reply

Oh, I think you can turn that into a warning instead of an error; it's an Eclipse setting.

Good luck with the next chapter :-)

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor