Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

class loading with "ftp" protocol fails

843790May 15 2007 — edited May 17 2007
i can load a class using the file protocol.
i can not load the same class with ftp
protocol.

this code works correctly:
String path = "/home/ftp/a.jar";
File dir = new File(path);
URL url = dir.toURL();
URL[] url_path = new URL[]{url};
URLClassLoader loader = new URLClassLoader(url_path);
Class c = loader.loadClass("hello");
now, if i change:
URL url = dir.toURL();
to
URL url = new URL("ftp://10.36.0.2/a.jar");
i get ClassNotFoundException.
yet, to test the validity of the URL, i type:
ftp://10.36.0.2/a.jar
into a browser. and the file is found correctly.

my guess is that this is some kind of
security issue??
i have no security policy, so how can i disable it
if this is the problem?

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2007
Added on May 15 2007
6 comments
257 views