Batik does not preview svg files locating inside a folder

I use apache batik to display some svg files on my program. Below is an example code which just shows an svg file in a frame.

public class SVGViewer {
    public SVGViewer() {
        JFrame frame = new JFrame("SVG Viewer");
        frame.setPreferredSize(new Dimension(500, 500));

        JSVGCanvas c = new JSVGCanvas();
        c.setLocation(0, 0);
public static void main(String[] args) {
        new SVGViewer();

Using the following svg as the image I want to see,

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="" xmlns:xlink="" x="0px" y="0px"
     viewBox="0 0 512 352" enable-background="new 0 0 512 352" xml:space="preserve">
<filter  id="DropShadow">
    <feGaussianBlur  stdDeviation="3"></feGaussianBlur>
<g id="XMLID_1_" filter="url(#DropShadow)">
    <path id="XMLID_13_" fill="#231F20" d="M485,349.5H27c-13.5,0-24.5-11-24.5-24.5V27c0-13.5,11-24.5,24.5-24.5h458

I get this error (and no image is displayed)

The thing is that when I move the image outside the folder, I see it normally. It may has to do something about the DOM of the file but I am not very familiar with this. Any ideas?

The code above works if you enter the absolute path of the svg file like this:

String currentPath = System.getProperty("user.dir");
c.setURI("file:/" + currentPath + "/test/image.svg");