Solved

Resources from applet's jar

Posted on 2001-08-02
3
959 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
Comment Utility
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
Comment Utility
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
Comment Utility
Or may be the paths are not right...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now