Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Runtime file reference
Runtime file reference [message #216609] Fri, 07 October 2005 10:37 Go to next message
Eclipse UserFriend
Originally posted by: terencems.discovery.co.za

Hi,

I hope that this is the correct newsgroup; I apologise in advance if its
not.

Don't know if anyone's experienced this problem but I can't seem to access
certain files at run-time. I experienced this problem previously with 3.0
and now it seems to be the same with 3.1.

Basically, I have a java class, A, that's trying to reference an image at
run time in a folder image_folder/image_file.jpg e.g ("data/nehe.png"),
but I get java.io.FileNotFoundException in my console when I try to run
this.

It's not code I've written (it's been tested and works by the relevant
authors and others have used without much hassle). In the above instance,
it's happening in Lesson 6 of NeHe's OpenGL tutorial (couldn't load any of
the image files that the code was using). I experienced the same problem
trying to run the Java3D tutorials as well. There's no other project
setting or class path issue I can think of that could be causing this. I
also tested the Java3D code in another IDE and it seemed to pick up the
necessary image files at runtime, but I just can't get the code to work in
Eclipse.

I would really appreciate any advice as I've forsaken all other IDEs and
use Eclipse extensively.
Re: Runtime file reference [message #216622 is a reply to message #216609] Fri, 07 October 2005 11:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

What is the exact piece of code used to access the file? How it is
accessed will determine where it should be at to be found.


--
Thanks,
Rich Kulp
Re: Runtime file reference [message #217573 is a reply to message #216622] Fri, 21 October 2005 07:26 Go to previous message
Eclipse UserFriend
Originally posted by: terencems.discovery.co.za

Rich Kulp wrote:

> What is the exact piece of code used to access the file? How it is
> accessed will determine where it should be at to be found.

Sorry for the delayed response:

Source files:
examples.conicWorld.ConicWorld.java

Image files:
examples.images.earth.jpg

The code snippet (which I'm pretty sure is correct as it worked when I
tried it in a different IDE):

texImage = new java.net.URL(getCodeBase().toString() +
"../images/earth.jpg");

and it's surround by a try/catch.

The above made me think that there's something wrong in the way I'm
organizing my file/package structure or I'm just not telling Eclipse how
to run the compiled java properly.

Thanks in advance for any insight/input
Previous Topic:Error Evaluating using debugger
Next Topic:Accessing com objects
Goto Forum:
  


Current Time: Tue Jul 22 15:36:15 EDT 2025

Powered by FUDForum. Page generated in 0.03267 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top