Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.net.*;
  2. public class MyLoader {
  3. public static void main (String argv[]) throws Exception {
  4.  
  5.  
  6. 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
  7.  
  8. // Load class from class loader. argv[0] is the name of the class to be loaded
  9. Class c = loader.loadClass (argv[0]);
  10.  
  11. // Create an instance of the class just loaded
  12. Object o = c.newInstance();
  13.  
  14. }
  15. }
  16.  
  17. public class Tester {
  18.  
  19. public Tester () {
  20. System.out.println ("Hello there");
  21. }
  22.  
  23. public static void main(String argv[]) {
  24. System.out.println("Network Class Loaders");
  25. }
  26. }
  27.  
  28. Exception in thread "main" java.net.MalformedURLException: no protocol: 192.168
  29. .0.1user
  30. at java.net.URL.<init>(Unknown Source)
  31. at java.net.URL.<init>(Unknown Source)
  32. at java.net.URL.<init>(Unknown Source)
  33. at MyLoader.main(MyLoader.java:7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement