title: batik-rasterizer.jar - convert svg to png
body: <p>I was try yo setup  an export server in my linux server with the following command to download graph as image from <a href="http://www.highcharts.com/docs/export-module/setting-up-the-server" rel="nofollow"><strong><em>Highcharts</em></strong></a>.</p>
  
  <pre><code>$command = "java -jar batik-rasterizer.jar -m image/png -d temp/1a6b5dd08ec607454b81f91097fb24a6.png temp/1a6b5dd08ec607454b81f91097fb24a6.svg 2&gt;&amp;1 "; 
  $output = shell_exec($command);
  echo "Command: $command &lt;br&gt;";
  echo "Output: $output";
  </code></pre>
  
  <p>It creates an image in my local windows machine perfectly ,But i uploaded it in my linux server,I am getting errors.</p>
  
  <pre><code> About to transcode 1 SVG file(s) Converting 1a6b5dd08ec607454b81f91097fb24a6.svg to temp/1a6b5dd08ec607454b81f91097fb24a6.png ... (.:21519): Gtk-WARNING **: cannot open display:
  </code></pre>
  
  <p>Why this happens?</p>
  
  <p><strong><em>And i notice that an image is created with 0 kb invalid image</em></strong></p>
  
  <p><strong>Note:</strong> <em>I have also tried the following methods</em>.</p>
  
  <p>1)folder containing batik-rasterizer.jar and the files have owner as root and permission is set as 777.</p>
  
  <p>2)i also try to execute it with <strong>/user/bin/java</strong> , <strong>which java</strong> insted pf <strong>java</strong> command.</p>
  
  <p>3)I also try to execute this command as root using terminal using putty,Java is installed in my server.</p>