Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- public class MyLoader {
- public static void main (String argv[]) throws Exception {
- URLClassLoader loader = new URLClassLoader(new URL[] { new URL("\192.168.0.1\user") });//ip of other computer where from user folder i use Tester class
- // Load class from class loader. argv[0] is the name of the class to be loaded
- Class c = loader.loadClass (argv[0]);
- // Create an instance of the class just loaded
- Object o = c.newInstance();
- }
- }
- public class Tester {
- public Tester () {
- System.out.println ("Hello there");
- }
- public static void main(String argv[]) {
- System.out.println("Network Class Loaders");
- }
- }
- Exception in thread "main" java.net.MalformedURLException: no protocol: 192.168
- .0.1user
- at java.net.URL.<init>(Unknown Source)
- at java.net.URL.<init>(Unknown Source)
- at java.net.URL.<init>(Unknown Source)
- at MyLoader.main(MyLoader.java:7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement