2 // JavaCocoaAdapter.java
5 // Created by Andreas Monitzer on 2006-08-01.
6 // Copyright 2006 Andreas Monitzer. All rights reserved.
11 import java
.net
.URLClassLoader
;
13 import java
.util
.Vector
;
16 public class JavaCocoaAdapter
{
17 public static ClassLoader
classLoader(Vector jars
, ClassLoader parent
) { // Vector of String file paths
18 System
.err
.println(jars
.toString());
20 // convert vector of strings to array of URLs
22 URL
[] urls
= new URL
[jars
.size()];
26 for(i
= 0; i
< jars
.size(); i
++)
27 urls
[i
] = new File((String
)jars
.elementAt(i
)).toURI().toURL();
28 } catch(java
.net
.MalformedURLException e
) {
33 return URLClassLoader
.newInstance(urls
,(parent
!= null)?parent
:ClassLoader
.getSystemClassLoader());