Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Resources from applet's jar

Posted on 2001-08-02
3
Medium Priority
?
991 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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…
Suggested Courses

916 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