• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

url and classloader

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
TLTEO
Asked:
TLTEO
  • 5
  • 3
1 Solution
 
objectsCommented:
Use:

URL url = ClassLoader.getSystemResource(name);

or

URL url = class.getResource(name);

0
 
CEHJCommented:
listening...
0
 
objectsCommented:
Then editor.setPage(url);
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
TLTEOAuthor Commented:
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
 
objectsCommented:
Is the html page in a directory?
Did you try using class.getResource()?
0
 
TLTEOAuthor Commented:
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
 
objectsCommented:
> 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
 
TLTEOAuthor Commented:
my mistake, got it now cheers
0
 
objectsCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now