File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to read logging.properties from inside jar file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to read logging.properties from inside jar file?" Watch "How to read logging.properties from inside jar file?" New topic
Author

How to read logging.properties from inside jar file?

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi all,

I am struggling with java.util.logging: I have a custom ub-logging.properties which works fine when I run the runme.jar from a directory where there's also the ub-logging.properties - using



but I can find no way to make java take it from inside the runme.jar itself

If it was allowed to pack it directly into submission.jar, it could again work after the tester unpacked the submission.jar... But from the instructions I think we are not allowed to put any additional files there...

I'm not sure what to do now - am I overlooking a way to make java read it from inside the jar, or is it just not possible? This would be a pity because I wanted to have a "how to start it with application-specific logging" section in the Guide And of course the standard behaviour of the jdk does not fit too well here...

Thanks a lot for any suggestions!
Sigrid
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Hi Sigrid,

My advice: it's not needed/required and it gives you problems, simply don't do it. You won't get extra credit for doing it.


It is not allowed to define extra parameters when running the runme.jar

Maybe you can try to create a default logging.properties file in the working directory (from within your code, similar way of working with the suncertify.properties file) and use that to initialize your logging properties.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi Roel,

thanks for your quick answer! You're right, it makes no sense spending time on something that does not count anyway (I think they say

Your programs must not require use of command line arguments other than the single mode flag,


which for me would mean that it's allowed to use ommand line arguments, as long as the application will run without, too - but anyway)

Unfortunately I just discovered a much bigger problem which will probably keep me from submitting any time soon - would be great if you could have a look at my new post

Thanks again
Sigrid
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Hi Sigrid,

Regarding your remark you are right: if your program runs without the command line arguments you are just fine. I notice that a lot of people have difficulties with just doing what is expected, nothing more, nothing less And most of the time that extra thing gives them some kind of a problem and they have to spend some time on solving the issue although they won't receive any extra credit for it.

I took a look to your other thread and noticed the great Roberto answered this one already, but I'll post my opinion too.

Kind regards,
Roel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to read logging.properties from inside jar file?