error while converting svg to jpg file in eclipse using java <p>I am trying to convert an svg string into jpg file using batik in JAVA. I am able to do that successfully in netbeans IDE 8.0.2. But when I use the same code in eclipse Mars Release (4.5.0), it throws error and creates jpg file with 0byte size. Can someone please help what's the problem here.</p> <p>I have stored this SVG string in image.txt file. And I am reading this file and storing it in string in the code.</p> <p>The input svg string is:</p> <pre><code>&lt;svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="v-2" width="1200px" height="1200px"&gt;&lt;g id="v-3" class="viewport" transform="scale(1,1)"&gt;&lt;g id="j_1" model-id="202c3451-5c59-4543-81a9-0fdbedebc2ca" class="element basic Rect" fill="#ffffff" stroke="none" transform="translate(186,36)"&gt;&lt;g class="rotatable" id="v-5" transform="rotate(0,60,15)"&gt;&lt;g class="scalable" id="v-6" transform="scale(1.2,0.5)"&gt;&lt;rect id="v-7" fill="#00FFFF" stroke="#000000" width="100" height="60"/&gt;&lt;/g&gt;&lt;text id="v-8" y="0.8em" display="null" xml:space="preserve" fill="#000000" font-size="14" text-anchor="middle" font-family="Arial, helvetica, sans-serif" transform="translate(60,7)"&gt;&lt;tspan dy="0em" x="0" id="v-10" class="v-line"&gt;e1&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g id="j_2" model-id="1f786afb-0a69-4a84-a737-cec94aede7c2" class="element basic Ellipse" fill="#ffffff" stroke="none" transform="translate(381,207)"&gt;&lt;g class="rotatable" id="v-11" transform="rotate(0,60,15)"&gt;&lt;g class="scalable" id="v-12" transform="scale(2,0.75)"&gt;&lt;ellipse id="v-13" fill="#FFC299" stroke="#000000" rx="30" ry="20" cx="30" cy="20"/&gt;&lt;/g&gt;&lt;text id="v-14" y="0.8em" display="null" xml:space="preserve" font-size="14" text-anchor="middle" fill="#000000" font-family="Arial, helvetica, sans-serif" transform="translate(60,7)"&gt;&lt;tspan dy="0em" x="0" id="v-16" class="v-line"&gt;c1&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g id="j_3" model-id="cf6f4dfa-a4ed-4f65-911b-83de353c6755" class="link"&gt;&lt;path class="connection" stroke="black" id="v-17" d="M 416 200 263 66"/&gt;&lt;path class="marker-source" fill="black" stroke="black" id="v-18" d="M 10 0 L 0 5 L 10 10 z" transform="translate(420.70581560773115,210.7614383498162) scale(1,1) rotate(-138.7888946533203)"/&gt;&lt;path class="marker-target" fill="black" stroke="black" id="v-19" transform="translate(263,66) scale(1,1) rotate(41.21112060546878)"/&gt;&lt;path class="connection-wrap" id="v-20" d="M 416 200 263 66"/&gt;&lt;g class="labels" id="v-21"&gt;&lt;g class="label" id="v-29" label-idx="0" transform="translate(339.5, 133)"&gt;&lt;rect fill="white" rx="3" ry="3" x="-42.21875" y="-8.796875" width="84.4375" height="16"/&gt;&lt;text text-anchor="middle" font-size="14" id="v-30" y="0.8em" display="null" xml:space="preserve" transform="translate(0,-8)"&gt;&lt;tspan dy="0em" x="0" id="v-31" class="v-line"&gt;hasConstraint&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="marker-vertices" id="v-22"/&gt;&lt;g class="marker-arrowheads" id="v-23"&gt;&lt;g class="marker-arrowhead-group marker-arrowhead-group-source" id="v-26" transform="translate(415.4351510976791,216.77972750249086) scale(1,1) rotate(-138.7888946533203)"&gt;&lt;path class="marker-arrowhead" end="source" d="M 26 0 L 0 13 L 26 26 z"/&gt;&lt;/g&gt;&lt;g class="marker-arrowhead-group marker-arrowhead-group-target" id="v-27" transform="translate(271.56485378778143,56.22026454457441) scale(1,1) rotate(41.21112060546878)"&gt;&lt;path class="marker-arrowhead" end="target" d="M 26 0 L 0 13 L 26 26 z"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="link-tools" id="v-24"&gt;&lt;g class="link-tool" id="v-25" transform="translate(385.90911865234375, 173.64590454101562) "&gt;&lt;g class="tool-remove" event="remove"&gt;&lt;circle r="11"/&gt;&lt;path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z"/&gt;&lt;title&gt;Remove link.&lt;/title&gt;&lt;/g&gt;&lt;g class="tool-options" event="link:options"&gt;&lt;circle r="11" transform="translate(25)"/&gt;&lt;path fill="white" transform="scale(.55) translate(29, -16)" d="M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z"/&gt;&lt;title&gt;Link options.&lt;/title&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="v-4"/&gt;&lt;/svg&gt; </code></pre> <p>The code used in both the IDEs:</p> <pre><code>public static void main(String[] args) { OutputStream ostream = null; for(int i=0; i&lt;1; i++){ try { // Create a JPEG transcoder String svgStr = getImageString(); File svgFile = File.createTempFile("tempImage", ".svg"); FileOutputStream fop = new FileOutputStream(svgFile); byte[] contentInBytes = svgStr.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); JPEGTranscoder t = new JPEGTranscoder(); // Set the transcoding hints. // Create the transcoder input. FileInputStream in = new FileInputStream(svgFile); TranscoderInput input = new TranscoderInput(in); // Create the transcoder output. ostream = new FileOutputStream("D://tempImage.jpg"); TranscoderOutput output = new TranscoderOutput(ostream); // Save the image. t.transcode(input, output); // Flush and close the stream. ostream.flush(); ostream.close(); } catch (FileNotFoundException ex) { Logger.getLogger(Class1.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Class1.class.getName()).log(Level.SEVERE, null, ex); } catch (TranscoderException ex) { Logger.getLogger(Class1.class.getName()).log(Level.SEVERE, null, ex); } finally { try { ostream.close(); } catch (IOException ex) { Logger.getLogger(Class1.class.getName()).log(Level.SEVERE, null, ex); } } } } private static String getImageString(){ String svgString = new String(); try { BufferedReader br = new BufferedReader(new FileReader("D://image.txt")); svgString = br.readLine(); br.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return svgString; } </code></pre> <p>The error message that I get in eclipse is:</p> <pre><code>Original message: The "null" identifier is not a valid value for the "display" property. org.apache.batik.transcoder.TranscoderException: null Enclosed Exception: null at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:132) at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156) at org.infosys.kbe.restapi.resources.ModelsResource.getPngFile(ModelsResource.java:866) at org.infosys.kbe.restapi.resources.ModelsResource.addPageforEachDiagram(ModelsResource.java:818) at org.infosys.kbe.restapi.resources.ModelsResource.lambda$0(ModelsResource.java:719) at java.util.ArrayList.forEach(Unknown Source) at org.infosys.kbe.restapi.resources.ModelsResource.createPDFusingPDFBox(ModelsResource.java:715) at org.infosys.kbe.restapi.resources.ModelsResource.generatePDFforModelWithId(ModelsResource.java:586) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:460) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.infosys.kbe.restapi.CORSFilter.doFilter(CORSFilter.java:27) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) </code></pre>