0

I am trying to get some files stored in my project folder. As answered in this question I tried the following code, just before trying it 'for real':

I created a Test class, very simple:

public class Test
{
    public URL url;

  public Test()
  {
    url = Test.class.getResource("/src/main/resources/parseID.xsd");
  }
}

And then a dummy MainClass:

public class MainClass {

    public static void main(String[] args) throws MalformedURLException {
        Test t = new Test();

        t.url = Test.class.getResource("/src/main/resources/parseID.xsl");

        System.out.println(t.url);
    }
}

This is giving a null display on my console. Both of the classes are in the same package. The resource is there, from the root of the project:

src/
 |  main/
 |   |  resources/
 |   |   |     parseID.xsd

Can anyone help me out ? I have trouble figuring out.

Community
  • 1
  • 1
Yassine Badache
  • 1,810
  • 1
  • 19
  • 38

0 Answers0