Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

loading image on java with relative path jar file

francy77Jun 14 2013 — edited Jun 17 2013

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.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2013
Added on Jun 14 2013
2 comments
1,196 views