Skip to main content

[JAVA2D] Problems with BufferedImage.createGraphics

2 replies [Last post]
Anonymous

Dear fellows,

I have a strange Problem with creation of Graphics2D for an BufferedImage. Code fragment:

BufferedImage bufferedImage1;
Graphics2D g2d;
int width = 1000; // absolute pixels
int height = 800; // absolute pixels

// Create a buffered image in which to draw
bufferedImage1 = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// Create a graphics contents on the buffered image
g2d = bufferedImage1.createGraphics();

When using JBuilder 8 Personal Edition with JDK 1.4.1-b21 under Windows98, all works fine and further use of graphics commands and final call of ImageIO.write(bufferedImage1, "png", new File(fileName4pic)) behave as expected.

When using the same JBuilder 8 Personal Edition with the same JDK 1.4.1-b21 under Windows2000, the following surprising error message is displayed:

java.lang.NoClassDefFoundError
at sun.java2d.Disposer.addRecord(Disposer.java:68)
at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:226)
at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:69)
at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
at markov8.TestBufferedImage.main(TestBufferedImage.java:27)
Exception in thread "main"

When using the JBuilder 9 Personal Edition with the same JDK 1.4.1_02-b06 under Red Hat Linux 9, the following surprising error message is displayed:

Exception in thread "main" java.lang.NoClassDefFoundError
at sun.java2d.Disposer.addRecord(Disposer.java:68)
at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:238)
at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:73)
at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
at markov8.TestBufferedImage.main(TestBufferedImage.java:27)

What the hell is going on here????

____________________________________________________
Aufnehmen, abschicken, nah sein - So einfach ist
WEB.DE Video-Mail: http://freemail.web.de/?mc=021200

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sven Mielordt

Thank you for the advice: when running directly without the JBuilder, all works properly. Obviously there is a problem with JBuilder or I made a mistake when installing it.
Thank you
Sven

Dmitri Trembovetski schrieb am 21.06.04 16:38:18:
>
> Hi Sven,
>
> do you see these problems when the application is run standalone
> (outside of JBuilder)?
>
> It looks like JBuilder does some mangling of the bootclasspath when
> it starts the app from IDE.
>
> Thank you,
> Dmitri
>
> On Mon, Jun 21, 2004 at 03:59:35PM +0200, Sven Mielordt wrote:
> > Dear fellows,
> >
> > I have a strange Problem with creation of Graphics2D for an BufferedImage. Code fragment:
> >
> > BufferedImage bufferedImage1;
> > Graphics2D g2d;
> > int width = 1000; // absolute pixels
> > int height = 800; // absolute pixels
> >
> > // Create a buffered image in which to draw
> > bufferedImage1 = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
> > // Create a graphics contents on the buffered image
> > g2d = bufferedImage1.createGraphics();
> >
> >
> > When using JBuilder 8 Personal Edition with JDK 1.4.1-b21 under Windows98, all works fine and further use of graphics commands and final call of ImageIO.write(bufferedImage1, "png", new File(fileName4pic)) behave as expected.
> >
> > When using the same JBuilder 8 Personal Edition with the same JDK 1.4.1-b21 under Windows2000, the following surprising error message is displayed:
> >
> > java.lang.NoClassDefFoundError
> > at sun.java2d.Disposer.addRecord(Disposer.java:68)
> > at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
> > at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:226)
> > at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:69)
> > at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
> > at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
> > at markov8.TestBufferedImage.main(TestBufferedImage.java:27)
> > Exception in thread "main"
> >
> > When using the JBuilder 9 Personal Edition with the same JDK 1.4.1_02-b06 under Red Hat Linux 9, the following surprising error message is displayed:
> >
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError
> > at sun.java2d.Disposer.addRecord(Disposer.java:68)
> > at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
> > at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:238)
> > at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:73)
> > at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
> > at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
> > at markov8.TestBufferedImage.main(TestBufferedImage.java:27)
> >
> > What the hell is going on here????
> >
> > ____________________________________________________
> > Aufnehmen, abschicken, nah sein - So einfach ist
> > WEB.DE Video-Mail: http://freemail.web.de/?mc=021200
> >
> > ===========================================================================
> > To unsubscribe, send email to listserv@java.sun.com and include in the body
> > of the message "signoff JAVA2D-INTEREST". For general help, send email to
> > listserv@java.sun.com and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

_______________________________________________________
WEB.DE Video-Mail - Die E-Mail der n�chsten Generation!
Jetzt testen: http://freemail.web.de/?mc=021198

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Dmitri Trembovetski

Hi Sven,

do you see these problems when the application is run standalone
(outside of JBuilder)?

It looks like JBuilder does some mangling of the bootclasspath when
it starts the app from IDE.

Thank you,
Dmitri

On Mon, Jun 21, 2004 at 03:59:35PM +0200, Sven Mielordt wrote:
> Dear fellows,
>
> I have a strange Problem with creation of Graphics2D for an BufferedImage. Code fragment:
>
> BufferedImage bufferedImage1;
> Graphics2D g2d;
> int width = 1000; // absolute pixels
> int height = 800; // absolute pixels
>
> // Create a buffered image in which to draw
> bufferedImage1 = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
> // Create a graphics contents on the buffered image
> g2d = bufferedImage1.createGraphics();
>
>
> When using JBuilder 8 Personal Edition with JDK 1.4.1-b21 under Windows98, all works fine and further use of graphics commands and final call of ImageIO.write(bufferedImage1, "png", new File(fileName4pic)) behave as expected.
>
> When using the same JBuilder 8 Personal Edition with the same JDK 1.4.1-b21 under Windows2000, the following surprising error message is displayed:
>
> java.lang.NoClassDefFoundError
> at sun.java2d.Disposer.addRecord(Disposer.java:68)
> at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
> at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:226)
> at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:69)
> at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
> at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
> at markov8.TestBufferedImage.main(TestBufferedImage.java:27)
> Exception in thread "main"
>
> When using the JBuilder 9 Personal Edition with the same JDK 1.4.1_02-b06 under Red Hat Linux 9, the following surprising error message is displayed:
>
>
> Exception in thread "main" java.lang.NoClassDefFoundError
> at sun.java2d.Disposer.addRecord(Disposer.java:68)
> at sun.awt.image.BufImgSurfaceData.initRaster(Native Method)
> at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:238)
> at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:73)
> at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:266)
> at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1043)
> at markov8.TestBufferedImage.main(TestBufferedImage.java:27)
>
> What the hell is going on here????
>
> ____________________________________________________
> Aufnehmen, abschicken, nah sein - So einfach ist
> WEB.DE Video-Mail: http://freemail.web.de/?mc=021200
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".