I'm making a small java program that hopefully one day will be installed on peoples computers but atm I have one small hitch that has me stumped. There seems to be no easy way of finding the directory that my program resides in.
Here is the output of some of my stubs
And if I create a file in the current directory it ends up in the wrong place.
Now is this Forte just being a bitch or does every java program think the current directory is \bin?
How can I get around this. I dont really want to have to hardwire paths in. I would like to be able to just put the JAR file in a directory and run it one day.
Here is the output of some of my stubs
Code:
System.out.println("user dir= "+System.getProperty("user.dir","aRGH!"));
outputs: "user dir= C:\java\forte4j\bin"
System.out.println("user home= "+System.getProperty("user.home","aRGH!"));
outputs: "user home= C:\Documents and Settings\Surgeon"
And if I create a file in the current directory it ends up in the wrong place.
Code:
File currentdir = new File("x.y");
System.out.println("current dir= "+currentdir.getAbsolutePath());
outputs: "current dir= C:\java\forte4j\bin\"
Now is this Forte just being a bitch or does every java program think the current directory is \bin?
How can I get around this. I dont really want to have to hardwire paths in. I would like to be able to just put the JAR file in a directory and run it one day.