mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
get things back in working order again after losing the classloader battle
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user