Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Re: Really having trouble making jar files work with pictures

    The classpath is set by using an option of the java command: -cp
    For example:
    java -cp .;C:\Test TheClassHere
    sets the classpath to the current directory (.) and to C:\Test


    Here is a...
  2. Re: Really having trouble making jar files work with pictures

    To use getResource() the image file must be in a folder or path accessible from the classpath.
    I don't see how to get from the classpaths you posted to the C:\Test\ folder.
    You need to add a path...
  3. Re: Really having trouble making jar files work with pictures

    The path to the file is made of two parts:
    the classpath
    the path passed to the getResource() method.

    See post#10


    The File object is not related to the classpath.
    This code will printout...
  4. Re: Really having trouble making jar files work with pictures

    The getResource() method does not take File object as an argument. Why are you using a File object as part of the argument?
    getResource() uses the value of the classpath to find files. See post#10...
  5. Re: Really having trouble making jar files work with pictures

    What is the classpath when you execute the code?
    Where is the image file located?
  6. Re: Really having trouble making jar files work with pictures

    Glad you got it working.
  7. Re: Really having trouble making jar files work with pictures

    The getResource() method uses the classpath to start the search for the file.
    What is the full path to the file?
    Where does the classpath point when the code is executed?
    What path is given to the...
  8. Re: Really having trouble making jar files work with pictures

    Does that code use the correct filename in the getResource() method?
    Print out (f + ".png") to see
Results 1 to 8 of 8