Solved

Resources from applet's jar

Posted on 2001-08-02
3
961 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is the main difference between git clone and fetch ann pull and push commands 2 73
ArrayIndexOutOfBoundException 9 68
eclipse argument 14 53
Java Loop 6 50
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

867 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

19 Experts available now in Live!

Get 1:1 Help Now