Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2013
    Posts
    25
    Thanks
    8
    Thanked 1 Time in 1 Post

    File retrieval problem

    I know this seems like a simple problem but can someone please clarify for me exactly how to organize code for file retrieval. I'm writing a java applet and I always seem to have a problem being able to retrieve files for use. In this case, I'm having problems retrieving an image. I've made a resources within the project folder (under the same directory as the src folder) yet can't seem to pull up a file for a simple image view. Some explanation/help would be grateful.
    Example code:

    Code:
    try{
            URL url = new URL("resources\\images\\J****.png");
            ImageIO.read(url);
           }
           catch (IOException e){
               System.out.println("There was no file");
           }

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Have you added the resources to the build path when you compile?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New Coder
    Join Date
    Sep 2013
    Posts
    25
    Thanks
    8
    Thanked 1 Time in 1 Post
    I did not but I realize now that the path doesn't work if its a url. It has to be a file retrieval method rather than a URL retrieval.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •