Link to home
Start Free TrialLog in
Avatar of howesd
howesd

asked on

URL Problem

I want to load information in to an Applet in much the same as a Windows program uses an Ini file. If I use the form
URL d = new URL("http://p1/scales/intervals");, then it works fine.

I want to make the applet work in any directory structure, so I don't need to hardcode the URL. I thought that the following would work
URL d = new URL(getCodeBase(),"intervals.txt");

Everytime I do this, I get a MalFormedURL exception.

Can you point me in the right direction with this please?
ASKER CERTIFIED SOLUTION
Avatar of jpk041897
jpk041897

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of howesd
howesd

ASKER

Thanks for your response - it confirmed that I was on the right lines. The problem that I was encountering actually arose as I was calling this method from within my applets constructor. As soon as I moved it to the init method it worked!