Solved

Resources from applet's jar

Posted on 2001-08-02
3
973 Views
Last Modified: 2012-05-04
Hello!

Could anyone tellme please is it the way to load resource file from applet's jar?

I use the following line of code to load resources from a jar

InputStream is = getClass().getResourceAsStream("/resourcepath/resourcename");

or

InputStream is = getClass().getResourceAsStream("resourcepath/resourcename");

for relative pathes.

All works well when I start it as application. But when I start it as applet resources are not found.

What's the matter and what the way achieve this?

Thanks!

0
Comment
Question by:Kit_
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
giamtrot earned 50 total points
ID: 6347511
In an Applet I did the first syntax you write worked well with a jar package.
What message do you exactly get?
Do you get an exception or only the resource is not find?
Have you checked into the jar file the path are right?

Giamtrot
0
 
LVL 16

Expert Comment

by:Valeri
ID: 6347756
That's the way !!!
I think there is something wrong in you .jar file. Have you included resources in your .jar file ?

Valeri
0
 
LVL 16

Expert Comment

by:Valeri
ID: 6347760
Or may be the paths are not right...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to install java on RHEL image on EC2 4 52
Java: The Public Class Main 4 44
Glassfish admin console not working 1 54
Java array sort 10 27
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question