equal
deleted
inserted
replaced
25 |
25 |
26 package sun.tools.serialver; |
26 package sun.tools.serialver; |
27 |
27 |
28 import java.io.*; |
28 import java.io.*; |
29 import java.io.ObjectStreamClass; |
29 import java.io.ObjectStreamClass; |
30 import java.util.Properties; |
30 import java.nio.file.Paths; |
31 import java.text.MessageFormat; |
31 import java.text.MessageFormat; |
32 import java.util.ResourceBundle; |
32 import java.util.ResourceBundle; |
33 import java.util.MissingResourceException; |
33 import java.util.MissingResourceException; |
34 import java.net.URLClassLoader; |
34 import java.net.URLClassLoader; |
35 import java.net.URL; |
35 import java.net.URL; |
36 import java.net.MalformedURLException; |
36 import java.net.MalformedURLException; |
37 import java.util.StringTokenizer; |
|
38 import sun.net.www.ParseUtil; |
|
39 |
37 |
40 /** |
38 /** |
41 * Supporting class for the serialver tool. |
39 * Supporting class for the serialver tool. |
42 */ |
40 */ |
43 public class SerialVer { |
41 public class SerialVer { |
50 |
48 |
51 /* |
49 /* |
52 * Create a URL class loader that will load classes from the |
50 * Create a URL class loader that will load classes from the |
53 * specified classpath. |
51 * specified classpath. |
54 */ |
52 */ |
55 static void initializeLoader(String cp) |
53 static void initializeLoader(String cp) throws IOException { |
56 throws MalformedURLException, IOException { |
54 String[] paths = cp.split(File.pathSeparator); |
57 URL[] urls; |
55 int count = paths.length; |
58 StringTokenizer st = new StringTokenizer(cp, File.pathSeparator); |
56 URL[] urls = new URL[count]; |
59 int count = st.countTokens(); |
|
60 urls = new URL[count]; |
|
61 for (int i = 0; i < count; i++) { |
57 for (int i = 0; i < count; i++) { |
62 urls[i] = ParseUtil.fileToEncodedURL( |
58 urls[i] = Paths.get(paths[i]).toUri().toURL(); |
63 new File(new File(st.nextToken()).getCanonicalPath())); |
|
64 } |
59 } |
65 loader = new URLClassLoader(urls); |
60 loader = new URLClassLoader(urls); |
66 } |
61 } |
67 |
62 |
68 /* |
63 /* |