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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • 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
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!

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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