How can I move outside of the jar file?

I am creating a file jar

with gradle, my application is using log4j

. Mine

was originally embedded in a jar file. I moved it outdoors to be able to modify it in production. I've updated the file META-INF/MANIFEST.MF

embedded in the jar file to reflect this:

Class-Path: lib/log4j-1.2.1 lib/slf4j-api-1.4.2.jar
            lib/slf4j-api-1.5.6.jar lib/slf4j-log4j12-1.5.6.jar


My filetree looks like this on a Windows 7 32 bit machine:



I start my application with this command:

java -Dlog4j.configuration='lib\' -Dlog4j.debug=true -jar myapp.jar > logs/output.log


my logs/output.log

says log4j couldn't find its properties file:

log4j: Trying to find ['lib\'] using context classloader sun.misc.Launcher$AppClassLoader@17fa65e.
log4j: Trying to find ['lib\'] using sun.misc.Launcher$AppClassLoader@17fa65e class loader.
log4j: Trying to find ['lib\'] using ClassLoader.getSystemResource().
log4j: Could not find resource: ['lib\'].


I've also tried:



When I insert the file into the jar, it works:

log4j: Trying to find [] using context classloader sun.misc.Launcher$AppClassLoader@18385e3.
log4j: Using URL [jar:file:/C:/Users/User/Desktop/myapp/myapp.jar!/] for automatic log4j configuration.
log4j: Reading configuration from URL jar:file:/C:/Users/User/Desktop/myapp/myapp-2.1.9.jar!/
log4j: Parsing for [root] with value=[debug, A].


But I need this outside ... Any idea?


source to share

1 answer

Try the following:



but I'm curious: does the class definition in the manifest actually work? Jars, yes this standard, but does it work for too?



All Articles