Solved

url and classloader

Posted on 2002-04-22
9
210 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

626 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