Hello everyone,

I am currently trying to use maven for building my project. I have read
and followed the documentation found in the Maven Users Centre and it
really works quite well so far.

The problem I have now is, that I don't know how to run my application
once it is built with, say 'mvn package'. I tried 'java -jar
target/myproject.jar' (in the base directory of the project), but then
it doesn't find the jars it depends on. I have jaudiotagger and
sqlite-jdbc as a dependency, but it only cannot find sqlite-jdbc, which
I only need at runtime (and have specified as such).

After some searching I have found a way to solve the problem of missing
dependencies, by using 'java -cp $CLASSPATH:target/myproject.jar
my.package.MainClass', but then it doesn't find any resources I try to
load in my code with
"this.getClass().getClassLoader().getResource(...)". All resources are
placed in the src/main/resources directory. If I have no dependecies and
thus can run the application with "java -jar target/myproject.jar" it
finds the resources.

Is there some way to simplify this, say, by automatically generating a
startup script which can be used to start the application without having
to worry about all these things?

Thanks a lot,

Simon Lehmann

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to