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 ? :-/

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.

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!!

Do you mind to post relevant section of code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.