|
111 | 111 | import processing.app.Util; |
112 | 112 | import processing.app.syntax.JEditTextArea; |
113 | 113 | import processing.app.ui.Toolkit; |
| 114 | +import processing.data.StringList; |
114 | 115 | import processing.mode.java.JavaEditor; |
115 | 116 | import processing.mode.java.JavaMode; |
116 | 117 | import processing.mode.java.preproc.PdePreprocessor; |
@@ -295,36 +296,43 @@ protected void done() { |
295 | 296 | */ |
296 | 297 | protected ClassPath classPath; |
297 | 298 |
|
298 | | - //protected JFrame frmJavaDoc; |
299 | | - |
300 | | - protected String getJavaSearchPath() { |
301 | | - return System.getProperty("java.class.path") + |
302 | | - File.pathSeparatorChar + System.getProperty("java.home") + |
303 | | - File.separator + "lib" + File.separator + "rt.jar"; |
304 | | - } |
305 | 299 |
|
306 | 300 | /** |
307 | 301 | * Loads up .jar files and classes defined in it for completion lookup |
308 | 302 | */ |
309 | 303 | protected void loadJars() { |
310 | 304 | factory = new ClassPathFactory(); |
311 | 305 |
|
312 | | - StringBuilder path = new StringBuilder(); |
313 | | - String modeClassPath = getJavaSearchPath() + File.pathSeparatorChar + ((JavaMode) editor.getMode()).getSearchPath(); |
| 306 | + StringList entries = new StringList(); |
| 307 | + entries.append(System.getProperty("java.class.path")); |
| 308 | + entries.append(System.getProperty("java.home") + |
| 309 | + File.separator + "lib" + File.separator + "rt.jar"); |
| 310 | + |
| 311 | + String modeClassPath = ((JavaMode) editor.getMode()).getSearchPath(); |
314 | 312 | if (modeClassPath != null) { |
315 | | - path.append(modeClassPath); |
| 313 | + entries.append(modeClassPath); |
316 | 314 | } |
317 | 315 |
|
318 | 316 | if (errorCheckerService.classpathJars != null) { |
319 | 317 | synchronized (errorCheckerService.classpathJars) { |
320 | 318 | for (URL jarPath : errorCheckerService.classpathJars) { |
321 | | - //log(jarPath.getPath()); |
322 | | - path.append(jarPath.getPath() + File.pathSeparatorChar); |
| 319 | + entries.append(jarPath.getPath()); |
323 | 320 | } |
324 | 321 | } |
325 | 322 | } |
326 | 323 |
|
327 | | - classPath = factory.createFromPath(path.toString()); |
| 324 | +// // Just in case, make sure we don't run off into oblivion |
| 325 | +// String workingDirectory = System.getProperty("user.dir"); |
| 326 | +// if (entries.removeValue(workingDirectory) != -1) { |
| 327 | +// System.err.println("user.dir found in classpath"); |
| 328 | +// } |
| 329 | + |
| 330 | +// // hm, these weren't problematic either |
| 331 | +// entries.append(System.getProperty("user.dir")); |
| 332 | +// entries.append(""); |
| 333 | +// entries.print(); |
| 334 | + |
| 335 | + classPath = factory.createFromPath(entries.join(File.pathSeparator)); |
328 | 336 | log("Classpath created " + (classPath != null)); |
329 | 337 | log("Sketch classpath jars loaded."); |
330 | 338 | if (Platform.isMacOS()) { |
|
0 commit comments