Solved

Resources from applet's jar

Posted on 2001-08-02
3
976 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_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

710 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