Hello Guest

This is harder than it looks!!

  • 20 Replies
  • 20583 Views
This is harder than it looks!!
« Reply #15 on: November 24, 2003, 19:37:15 »
so ive got this working right on the absolute path, how would I go about making a relative path, cause "./data/nehe.png" doesn't work, neither does "data/nehe.png"??  :?:

This is harder than it looks!!
« Reply #16 on: November 25, 2003, 02:23:40 »
Find out where your class file is ending up.  I don't know how NetBeans works.  Does it place the class file in the same directory as the source?  Does it put it in it's own directory, ie classes/NeHexx or bin/NeHexx.  Are you using the package declaration or is it in the default package?  Here is a scenario:

NeHe06.java is in package NeHe06 so it will be in directory - c:\Java\src\NeHe06.  When you compile, the class file is in c:\Java\classes\NeHe06.  In this case, the texture needs to be in c:\Java\classes\data.  Then the absolute path works.  Even if you are using the default package or a package that is 6 deep, the texture would still be in the same spot.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

This is harder than it looks!!
« Reply #17 on: November 25, 2003, 02:47:52 »
What I did is find my current path.
File f = new File("");
System.out.println(f.getAbsolutePath());
Figure out were the image is in relation to the above.
I think I ended up using loadImage("bin/data/nehe.png")
ude!!!

This is harder than it looks!!
« Reply #18 on: November 25, 2003, 20:10:34 »
hey guys/dolls/gents/ladies, i just got eclipse, and I switched over..and to be honest, I am v. impressed...VERY!

so how would I go about doing a relative path in eclipse if I am not using any package names?

This is harder than it looks!!
« Reply #19 on: November 25, 2003, 20:47:32 »
Put the data directory directly in the same directory as your java source file.  This is also where the class file will end up by default.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

This is harder than it looks!!
« Reply #20 on: November 26, 2003, 16:12:47 »
thx alot dudes, much appreciated.