2 Replies Latest reply: Jun 17, 2013 6:06 AM by BIJ001 RSS

    loading image on java with relative path jar file

    francy77

      Hi all,

      i'm new to java, and i need a way to load an image. Try to explain better.

       

      1)

       

      I' ve created a library Notula, in the code there is the following statement:

      Image image2 = Image.getInstance(".\\img\\logo_ss.JPG");

       

      when i run the library (only the library) it run well.

       

      2)

      In another project i want to use that library so I've loaded the library in the new project (i can see the logo_ss.JPG inside the jar file), and Clean and Build the project. Everything goes well so far.

      When I try tu run the project (that use the library) i get:

      java.io.FileNotFoundException: C:\Programmi\Apache Software Foundation\Apache Tomcat 7.0.34\bin\.\img\logo_ss.JPG (Impossibile trovare il percorso specificato) "not possible to find the path specified".

       

      So the question is how i can load that image when i used the jar file created before?

       

      Thanks

      F.