Link to home
Start Free TrialLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

How Do I change a URL file location on my webspace for the same file on my Desktop - for a road trip.


On my road trip, in the car, I want to work on my invulnerable chess engine, (I'll move it from my PC to my Macbook)
but my chess piece .png files are on my web-space.

How can I change a URL object to be a local file, instead?

Passing the file's location into the URL constructor doesn't work, like some pages suggested.
What actually works, without deprecated solutions?

I have working..
URL url = new URL(" http://mydomain/graphicsFile.png");
pieceImages[0] = tk.createImage(url);

Open in new window

How do I do the same with a local file on a MacBook?

Avatar of CPColin
Flag of United States of America image

If that's java.awt.Toolkit you're using, there's an overload of the createImage() method that takes a string filename. Barring that, you might be able to use a URL if you start it with file://, instead of http://.
Avatar of CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

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