Hi there,

When I use maven to run a test, which includes loading a resource with
MyTest.class.getResource("fileName"), the method returns a relativ path.

file:E:/Daten/UPS/ch.xmatrix.gui.splash-impl/target/test-classes/afterClick.
png

There the leading slash is missing. Consequently, an exception is then
thrown.

URI is not hierarchical
java.lang.IllegalArgumentException: URI is not hierarchical
        at java.io.File.<init>(File.java:321)
        ...

When I run it from my IDE, then the correct path is returned with the
exactly same code:

file:/E:/Daten/UPS/ch.xmatrix.gui.splash-impl/target/test-classes/afterClick
.png

I suppose there is a classloader problem. Could it have to do with maven?

Daniel Frey


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to