Date: Tue, 10 Mar 1998 08:42:00 -0700 From: Sean Kelly <kelly@plutotech.com> To: Joe Shevland <joe.shevland@horizonti.com> Cc: freebsd-java@FreeBSD.ORG Subject: Re: Classpath & URLs Message-ID: <35055F48.DD56F6E5@plutotech.com> References: <199803100233.NAA27684@oznet15.ozemail.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> Can a Java application's classes be based, say, on a server, and accessed from > a client machine using the java command line script/executable, passing the > server URL/path in the classpath? The answer is a conditional "yes". The problem: a Java application can't do it out of the box. What you need to do is provide your own ClassLoader. Applets run in the appletviewer or in a web browser have such a customized ClassLoader that knows to turn a request for a certain class, say "fred.joe.Whatever", into a network request to the web server. The default ClassLoader for applications turns "fred.joe.Whatever" into "fred/joe/Whatever.class" and attempts to find that file by appending that string to each element of the current classpath. How much work is involved? Actually, not much. Most of java.net already has the things you need, and writing the ClassLoader itself is pretty simple. Take a look at java.lang.ClassLoader, especially the method loadClass. Good luck. --Sean To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35055F48.DD56F6E5>