Solved

url and classloader

Posted on 2002-04-22
9
206 Views
Last Modified: 2010-03-31
Hi

I wud like to display a page onto a Jeditor.
But the page is within a jar file.

How can i use classloader method to do it??
0
Comment
Question by:TLTEO
[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
  • 5
  • 3
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6962088
Use:

URL url = ClassLoader.getSystemResource(name);

or

URL url = class.getResource(name);

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 6962674
listening...
0
 
LVL 92

Expert Comment

by:objects
ID: 6964029
Then editor.setPage(url);
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:TLTEO
ID: 6966950
it does not work.

I have a file call thispage.html  in a jar file called mymain.jar


so I use URL url = ClassLoader.getSystemResource("thispage.html");

then editor.setPage(url);


but not giving the page
0
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 6967005
Is the html page in a directory?
Did you try using class.getResource()?
0
 

Author Comment

by:TLTEO
ID: 6967678
the html page is in the jar ,  no path or directory within it.

I tried class.getResource();

but coding error, illegal start of expreesion.  
0
 
LVL 92

Expert Comment

by:objects
ID: 6967707
> but coding error, illegal start of expreesion.  

Yes you need to call getResouces() on an instance of class.
Something like:

getClass().getResource("thispage.html");
0
 

Author Comment

by:TLTEO
ID: 6967987
my mistake, got it now cheers
0
 
LVL 92

Expert Comment

by:objects
ID: 6968009
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 95
ejb entity bean example 2 59
Print Rhino Java Array in Javascript 1 58
Java Eclipse Loop 3 50
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.
Suggested Courses

752 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