You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by juuser <ve...@hotmail.com> on 2007/11/26 13:53:26 UTC

batik-rasterizer.jar (cant convert jpg from svg)

Hi all !

I have strange problem. 
I have svg-file (file.svg). 

Now when I use batik-rasterizer, I CAN convert svg to png.
BUT when I try to convert svg to jpg, I get nasty error:

[code]
Converting file.svg to /home/raf/file.jpg ... Exception in thread "main"
java.lang.NoClassDefFoundError: com.sun.image.codec.jpeg.JPEGCodec
   at org.apache.batik.transcoder.image.JPEGTranscoder.writeImage(Unknown
Source)
   at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown
Source)
   at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
Source)
   at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
Source)
   at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown
Source)
   at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
   at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
   at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)
[/code]

My command is: java -jar /path/to/batik-rasterizer.jar -m image/jpeg -q 0.8
/path/to/file.svg

What could cause this error ? 

Thank you. 
 

-- 
View this message in context: http://www.nabble.com/batik-rasterizer.jar-%28cant-convert-jpg-from-svg%29-tf4874855.html#a13948656
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: batik-rasterizer.jar (cant convert jpg from svg)

Posted by juuser <ve...@hotmail.com>.
Hi Cameron.

Thanks for your reply.

I am using jre1.6.0_03. I downloaded this packet from sun-sites. (Linux RPM
self-extarcting packet).
And I extracted this packet to the folder: /usr/java/ and my Os Is Fedora 7.







Cameron McCormack-4 wrote:
> 
> Hi.
> 
> juuser:
>> Now when I use batik-rasterizer, I CAN convert svg to png.
>> BUT when I try to convert svg to jpg, I get nasty error:
>> 
>> Converting file.svg to /home/raf/file.jpg ... Exception in thread "main"
>> java.lang.NoClassDefFoundError: com.sun.image.codec.jpeg.JPEGCodec
> …
>> What could cause this error ? 
> 
> The transcoder is trying to use Sun’s JPEG codec classes, which are not
> present.  What JRE are you running Batik on?
> 
> -- 
> Cameron McCormack, http://mcc.id.au/
> 	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/batik-rasterizer.jar-%28cant-convert-jpg-from-svg%29-tf4874855.html#a13965795
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: batik-rasterizer.jar (cant convert jpg from svg)

Posted by Tonny Kohar <to...@gmail.com>.
Hi,

It maybe because your current env is setup using default Fedora Core
Java (GNU Java), instead of the Sun JVM (even though you install it).
To check you are using Sun Java (instead of GNU Java), just open
terminal / console / etc and type "java -version"

If by any case it is GNU Java, you can modify your env to use Sun JVM by:
(note: It is tested on my Fedora Core 6)

1) Download Sun Java RPM version or tar.gz version
2) install the RPM will end up in eg: /usr/java/jre1.5.0_xx
3) type the following command
   a) /usr/sbin/alternatives --install /usr/bin/java java
/usr/java/jre1.5.0_xx/bin/java 2
   b) /usr/sbin/alternatives --config java
Note: the point 3a is all in single line.
4) when asked to choose which java, just press 2 and enter
5) reboot if neccesarry
6) you are done, now fedora will use Sun Java
7) try type "java -version" in the terminal / console, make sure it is Sun Java

Note: if you want to go back to GNU Java just type
/usr/sbin/alternatives --config java, and press 1

If the above step still not working please do the following as well
1) Edit / create new file in /etc/profile.d/java.sh
2) inside that java.sh put the following
export J2RE_HOME=/opt/jre1.5.0_xx
export PATH=$J2RE_HOME/bin:$PATH
3) type the following command "source /etc/profile.d/java"
4) to make sure it is correct type "which java" which should indicate
eg: /opt/jre1.5.0_xx/bin/java

HINT: you could easily install multiple java version eg: 1.5 and 1.6 by
using the following ways:

/usr/sbin/alternatives --install /usr/bin/java java
/usr/java/jre1.5.0_xx/bin/java 1509 (for 1.5.0_xx)

/usr/sbin/alternatives --install /usr/bin/java java
/usr/java/jre1.6.0_xx/bin/java 1600 (for 1.6.0_xx)

and to choose Java version just type the following
/usr/sbin/alternatives --config java (press the number for Java you like to use)

Cheers
Tonny Kohar
-- 
Sketsa SVG Editor
imagine, design, create ...
http://www.kiyut.com

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: batik-rasterizer.jar (cant convert jpg from svg)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Sorry, realized too late, that it is a Sun JVM. But in that case, it's
quite strange, because the JPEG codec is still present in 1.6.0_03. But
since it's a Linux system, maybe some other JVM could still be present,
too. Maybe the wrong one got started and this wasn't noticed.

Jeremias Maerki



On 27.11.2007 11:15:37 Jeremias Maerki wrote:
> It's pretty obvious it's no Sun JVM. I think the question should be:
> which Batik version are you running? That's because the 1.7beta1 does
> have special image writer implementations which uses ImageIO (since Java
> 1.4) instead of Sun's JPEG codec. But maybe the mechanism for choosing
> the right ImageWriter doesn't work properly, yet. If you're on Batik 1.6,
> please check if it works with Batik 1.7beta1. If it doesn't we'll have
> to fix a bug.
> 
> Jeremias Maerki
> 
> 
> 
> On 27.11.2007 01:11:22 Cameron McCormack wrote:
> > Hi.
> > 
> > juuser:
> > > Now when I use batik-rasterizer, I CAN convert svg to png.
> > > BUT when I try to convert svg to jpg, I get nasty error:
> > > 
> > > Converting file.svg to /home/raf/file.jpg ... Exception in thread "main"
> > > java.lang.NoClassDefFoundError: com.sun.image.codec.jpeg.JPEGCodec
> > …
> > > What could cause this error ? 
> > 
> > The transcoder is trying to use Sun’s JPEG codec classes, which are not
> > present.  What JRE are you running Batik on?
> > 
> > -- 
> > Cameron McCormack, http://mcc.id.au/
> > 	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: batik-rasterizer.jar (cant convert jpg from svg)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
It's pretty obvious it's no Sun JVM. I think the question should be:
which Batik version are you running? That's because the 1.7beta1 does
have special image writer implementations which uses ImageIO (since Java
1.4) instead of Sun's JPEG codec. But maybe the mechanism for choosing
the right ImageWriter doesn't work properly, yet. If you're on Batik 1.6,
please check if it works with Batik 1.7beta1. If it doesn't we'll have
to fix a bug.

Jeremias Maerki



On 27.11.2007 01:11:22 Cameron McCormack wrote:
> Hi.
> 
> juuser:
> > Now when I use batik-rasterizer, I CAN convert svg to png.
> > BUT when I try to convert svg to jpg, I get nasty error:
> > 
> > Converting file.svg to /home/raf/file.jpg ... Exception in thread "main"
> > java.lang.NoClassDefFoundError: com.sun.image.codec.jpeg.JPEGCodec
> …
> > What could cause this error ? 
> 
> The transcoder is trying to use Sun’s JPEG codec classes, which are not
> present.  What JRE are you running Batik on?
> 
> -- 
> Cameron McCormack, http://mcc.id.au/
> 	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: batik-rasterizer.jar (cant convert jpg from svg)

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi.

juuser:
> Now when I use batik-rasterizer, I CAN convert svg to png.
> BUT when I try to convert svg to jpg, I get nasty error:
> 
> Converting file.svg to /home/raf/file.jpg ... Exception in thread "main"
> java.lang.NoClassDefFoundError: com.sun.image.codec.jpeg.JPEGCodec
…
> What could cause this error ? 

The transcoder is trying to use Sun’s JPEG codec classes, which are not
present.  What JRE are you running Batik on?

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org