0

hi
I use log4j framework for logging my program.
i insert log4j.xml in my project an test it.
everything was ok and logfile correctly was put in path.
but
when i made jar file and copy it to linux and run it
it return error

log4j:ERROR Could not open [log4j.xml].
java.io.FileNotFoundException: log4j.xml (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:583)
        at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:694)

what can i do ? :-/

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by peter_budo
0

When you run application from JAR file you can not write into files that are packaged inside, you can only read. Therefore if you need this file for writing on each application start up check if file exists or create it if necessary.

0

my problem is that when i copy jar file from windows to linux,then run my project,this give me error that log4j.xml not found ,but when i run in windows no error occur!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.