Solved

url and classloader

Posted on 2002-04-22
9
195 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
  • 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

758 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

21 Experts available now in Live!

Get 1:1 Help Now