get things back in working order again after losing the classloader battle

This commit is contained in:
benfry
2012-10-21 21:03:02 +00:00
parent f73efb8c51
commit 7eb2eecfe3
2 changed files with 24 additions and 3 deletions

View File

@@ -1020,9 +1020,10 @@ public abstract class Editor extends JFrame implements RunnerListener {
// and they gave up on MacRoman a long time ago.
// addToolMenuItem(menu, "processing.app.tools.FixEncoding");
if (Base.DEBUG) {
addToolMenuItem(menu, "processing.app.tools.ExportExamples");
}
// currently commented out
// if (Base.DEBUG) {
// addToolMenuItem(menu, "processing.app.tools.ExportExamples");
// }
// // These are temporary entries while Android mode is being worked out.
// // The mode will not be in the tools menu, and won't involve a cmd-key

View File

@@ -23,6 +23,7 @@
package processing.app.contrib;
import java.io.*;
import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;
@@ -108,8 +109,11 @@ public abstract class InstalledContribution implements Contribution {
Base.log("found lib: " + archives[j] + " for " + getName());
urlList[j] = archives[j].toURI().toURL();
}
// loader = new URLClassLoader(urlList, Thread.currentThread().getContextClassLoader());
loader = new URLClassLoader(urlList);
Base.log("loading above JARs with loader " + loader);
// System.out.println("listing classes for loader " + loader);
// listClasses(loader);
}
}
@@ -121,6 +125,22 @@ public abstract class InstalledContribution implements Contribution {
}
// doesn't work with URLClassLoader, but works with the system CL
static void listClasses(ClassLoader loader) {
// loader = Thread.currentThread().getContextClassLoader();
try {
Field f = ClassLoader.class.getDeclaredField("classes");
f.setAccessible(true);
Vector<Class> classes = (Vector<Class>) f.get(loader);
for (Class c : classes) {
System.out.println(c.getName());
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Return a list of directories that have the necessary subfolder for this
* contribution type. For instance, a list of folders that have a 'mode'