Nicolas Laurent

Greenhorn
+ Follow
since Apr 06, 2010
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 Nicolas Laurent

I have the following file layout (your typical eclipse layout) :
project
--images
-----img.png
--bin
----pkg1
------Main.class
----pkg2
------ImageLoader.class

Now image ImageLoader loads an image using the path "images/img.png". This will run fine in eclipse, but I'd like to be able to run this code via the command line without breaking eclipse compatibility. It seems that using something like "java pkg1/Main" from the bin directory will seek "bin/images/img.png" which of course does not exist. I tried adding the project directory to the classpath, without success.

So, is my intuition right and are pathnames relative to the location where to code actually resides and not to all possible locations in the classpath ?
Also, how could I use the java command to successfully run the program without breaking eclipse compatibility ?
13 years ago