Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Netbeans, relative path and user.dir problems.

807597Oct 12 2004 — edited Mar 12 2007
Honestly, I must be going blind. I have been searching high-and-low to solve this stupid problem.

I have a mounted fileSystem in Netbeans 3.6. There is a number of folders, with subfolers, e.g., com.username.program.frontend......etc., etc....

Part of the code pulls in image files from a different folder sitting beside the folder in which the class requiring this image belongs. In other words, I have a folder called Program, inside this folder are two subfolders Code and Pictures. In code is a class which requires an image from the folder Pictures.

Using the relative path as:

= new ImageIcon("Pictures\\icon.jpg");

It will not load this file. So I decided to try outputting what netbeans thinks is the user directory , by using:

System.out.println(System.getProperty("user.dir"));

I get the output.............. "C:\Program Files\Netbeans 3.6\"

So I am assuming that the relative paths attaches itself to "C:\Program Files\Netbeans 3.6\", which would not exist. I have looked throughout all of Netbeans, changed nearly bloomin everything, and I still can't seem to get this working. I have used the Eclipse IDE, and it uses the mounted directory as the user directory, hence relativepath would work. Netbeans on the other hand, isn't doing this!!!!

Help!!

Thanks :-)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2007
Added on Oct 12 2004
10 comments
1,577 views