Fixes "wrong class name error" on Windows.
This commit is contained in:
parent
dad0bdbf15
commit
1261af42bb
@ -189,6 +189,7 @@ public class SeSimClassLoader<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @param pathlist
|
||||||
* @param additional_pathlist
|
* @param additional_pathlist
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -208,6 +209,8 @@ public class SeSimClassLoader<T> {
|
|||||||
|
|
||||||
String class_name;
|
String class_name;
|
||||||
class_name = fn.substring(path.length());
|
class_name = fn.substring(path.length());
|
||||||
|
// in case we are under Windows, replace \ width /
|
||||||
|
class_name = class_name.replace("\\", "/");
|
||||||
class_name = class_name.substring(1, class_name.length() - 6).replace('/', '.');
|
class_name = class_name.substring(1, class_name.length() - 6).replace('/', '.');
|
||||||
|
|
||||||
Class<T> c = loadClass(path, class_name);
|
Class<T> c = loadClass(path, class_name);
|
||||||
@ -215,8 +218,6 @@ public class SeSimClassLoader<T> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.add(c);
|
result.add(c);
|
||||||
//System.out.printf("Here is an instance for %s: %s\n", iface.getName(), class_name);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fn.toLowerCase().endsWith(".jar")) {
|
if (fn.toLowerCase().endsWith(".jar")) {
|
||||||
@ -230,19 +231,14 @@ public class SeSimClassLoader<T> {
|
|||||||
|
|
||||||
String class_name = jarentry.getName();
|
String class_name = jarentry.getName();
|
||||||
|
|
||||||
System.out.printf("Looking into jar: %s - %s\n", path, class_name);
|
|
||||||
|
|
||||||
if (class_name.endsWith(".class")) {
|
if (class_name.endsWith(".class")) {
|
||||||
|
|
||||||
class_name = class_name.substring(0, class_name.length() - 6).replace('/', '.');
|
class_name = class_name.substring(0, class_name.length() - 6).replace('/', '.');
|
||||||
|
|
||||||
Class<T> c = loadClass(path, class_name);
|
Class<T> c = loadClass(path, class_name);
|
||||||
if (null == c) {
|
if (null == c) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.add(c);
|
result.add(c);
|
||||||
//System.out.printf("Here is an instance for %s: %s\n", iface.getName(), class_name);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user