Hello Everyone.
I am a programmer who just switched from windows to Mac and I am having trouble with relative paths in Java (I'm using Eclipse BTW)...
In the program I was trying to load images from jpg files. something like:
bgImage = Resources.getResource("resources/images/bg.jpg");
I am getting an error, the file cannot be found.
In windows, this relative path starts from the src folder (.../[Project Folder]/src), so all I had to do was put all my image and other resource files in the src folder.
I tried placing this image file everywhere (bin folder, project folder, workspacee folder) just to findout where the relative path starts. But the file still can't be found when I run the program.
My questions are:
1. Is there anything wrong with how I constructed the relative path? (In windows this works)
2. In Mac OS, where is the working directory from which the relative path will start?
Finally, how do I access files and folders without resorting to absolute paths?
I am a programmer who just switched from windows to Mac and I am having trouble with relative paths in Java (I'm using Eclipse BTW)...
In the program I was trying to load images from jpg files. something like:
bgImage = Resources.getResource("resources/images/bg.jpg");
I am getting an error, the file cannot be found.
In windows, this relative path starts from the src folder (.../[Project Folder]/src), so all I had to do was put all my image and other resource files in the src folder.
I tried placing this image file everywhere (bin folder, project folder, workspacee folder) just to findout where the relative path starts. But the file still can't be found when I run the program.
My questions are:
1. Is there anything wrong with how I constructed the relative path? (In windows this works)
2. In Mac OS, where is the working directory from which the relative path will start?
Finally, how do I access files and folders without resorting to absolute paths?