John Luckcuck

Greenhorn
+ Follow
since Apr 18, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John Luckcuck

Simon, your a star ! I'd tried the class.getResource("") method before but it kept giving me the runtime of the appserver, but the getServletContext().getResource() works fine. Many thanks !
Does anybody know how to reference a directory packaged within an EAR file other than using a System property to manualy specify the absolute location of the installed EAR. In my code, I want to load a properties file in a config directory packaged within my WAR.
If I do a 'new File("config/config.props")' the code looks in the bin directory of my appserver! I cannot seem to reference file resources within my EAR.
Please Help
Cheers,
John
Good point, I've decided to take it out, I started spending far to much time deciding what to log and what not to log etc. It was taking my focus away from presenting what wa asked for. I don't believe there's any marks available for extra functionaility - a guy here has got an excellent mark just doing what was required.
Cheers Peter,
I've decided to stick with my properties file and leave it outside the jar (which is sensible) to allow users to pre-configure their client / server without having to specify command line parameters. Of course, I wont be ignoring the command line parameters, the properties file will merely define my defaults. Any extra command line parameters will overwrite those used in the properties file.
How would logging or tracing be looked upon if it existed within the application. I've started to implement a Logging Facility that can be turned off and on. You can specify STD OUT or a file and you can specify a level of logging (0=off, 1=exceptions, 2=trace, 3=debug).
Has anyone got any comments on this ?
I've resolved this issue by using :
URL url = this.getClass().getResource("/config/fbn.props");
properties.load(url.openStream());
But maybe using a properties file was a little OTT in the first place :roll:
I'm trying to load a properties file located /config/fbn.props in my jar. This works fine outside the jar. I'm using:

If I use the same principle for loading an image, this works fine :

I assume the problem is comming up with a URL that is compatible with the "internal references" of the jar. What's the best way (or working way even!) of obtaining the path to files within the jar ?
Thanks in advance