Ben Carlson

Greenhorn
+ Follow
since Nov 25, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Carlson

That's a really good idea, one I hadn't thought of! DOH!
Ok, not to beat a dead horse, but, on the same train of thought, is there a way to reference a txt/xml/html file using the class style path (i.e. "com.foo.bar.xml")? I can see some issues, but it seems reasonable that others would have similar problems... ?
Thanks again for your quick answer, Cindy!
Ben Carlson
22 years ago
Hello Everyone!
I am having a fair bit of trouble with properties files, namely how to ensure that they are in the same location on various platforms without recompiling.
I develop in Windows at work, and on Linux at home, and every time I transfer code, I have to edit my classes and recompile so they have the proper path... example:
c:\apps\search\.properties //windows
/home/bcarlson/apps/search/.properties //Linux
I would have assumed(silly me!) that I should be able to place a .properties file in a dir in the classpath and just use:
Properties defaultProps = new Properties();
try {
defaultProps.load(new FileInputStream(".properties");
} catch (IOException e) {
....etc...
to grab from my /home/bcarlson/apps/search dir...? any thoughts? Examples of how you've solved this? I'm probably missing something simple, because I assume most people use .properties files on a regular basis... ?
Thanks so much!!
Ben Carlson
22 years ago
this is a quick fix... I haven't found (then again I haven't looked) another way of doing this...
String str = "" + integer;
To convert a string to an integer, use this:
int i = Integer.parseInt(String);
22 years ago