diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index 122c89b7b..4713686d7 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -1163,7 +1163,7 @@ public class JavaBuild { /// create the main .jar file - HashMap zipFileContents = new HashMap(); +// HashMap zipFileContents = new HashMap(); FileOutputStream zipOutputFile = new FileOutputStream(new File(jarFolder, sketch.getName() + ".jar")); @@ -1191,7 +1191,18 @@ public class JavaBuild { addClasses(zos, binFolder); // add the data folder to the main jar file - addDataFolder(zos); +// addDataFolder(zos); + // For 2.0a2, make the data folder a separate directory, rather than + // packaging potentially large files into the JAR. On OS X, we have to hide + // the folder inside the .app package, while Linux and Windows will have a + // 'data' folder next to 'lib'. + if (sketch.hasDataFolder()) { + if (exportPlatform == PConstants.MACOSX) { + Base.copyDir(sketch.getDataFolder(), new File(jarFolder, "data")); + } else { + Base.copyDir(sketch.getDataFolder(), new File(destFolder, "data")); + } + } // add the contents of the code folder to the jar if (sketch.hasCodeFolder()) { @@ -1210,7 +1221,7 @@ public class JavaBuild { cp += codeList[i] + File.pathSeparator; } } - packClassPathIntoZipFile(cp, zos, zipFileContents); +// packClassPathIntoZipFile(cp, zos, zipFileContents); // this was double adding the code folder prior to 2.0a2 } zos.flush(); @@ -1229,31 +1240,33 @@ public class JavaBuild { /// add contents of 'library' folders to the export - for (Library library : importedLibraries) { // add each item from the library folder / export list to the output for (File exportFile : library.getApplicationExports(exportPlatform, exportBits)) { // System.out.println("export: " + exportFile); String exportName = exportFile.getName(); if (!exportFile.exists()) { - System.err.println("File " + exportFile.getName() + " does not exist."); + System.err.println(exportFile.getName() + + " is mentioned in export.txt, but it's " + + "a big fat lie and does not exist."); } else if (exportFile.isDirectory()) { //System.err.println("Ignoring sub-folder \"" + exportList[i] + "\""); - if (exportPlatform == PConstants.MACOSX) { - // For OS X, copy subfolders to Contents/Resources/Java - Base.copyDir(exportFile, new File(jarFolder, exportName)); - } else { - // For other platforms, just copy the folder to the same directory - // as the application. - Base.copyDir(exportFile, new File(destFolder, exportName)); - } +// if (exportPlatform == PConstants.MACOSX) { +// // For OS X, copy subfolders to Contents/Resources/Java + Base.copyDir(exportFile, new File(jarFolder, exportName)); +// } else { +// // For other platforms, just copy the folder to the same directory +// // as the application. +// Base.copyDir(exportFile, new File(destFolder, exportName)); +// } } else if (exportFile.getName().toLowerCase().endsWith(".zip") || exportFile.getName().toLowerCase().endsWith(".jar")) { Base.copyFile(exportFile, new File(jarFolder, exportName)); jarListVector.add(exportName); + // old style, prior to 2.0a2 // } else if ((exportPlatform == PConstants.MACOSX) && // (exportFile.getName().toLowerCase().endsWith(".jnilib"))) { // // jnilib files can be placed in Contents/Resources/Java @@ -1263,11 +1276,17 @@ public class JavaBuild { // // copy the file to the main directory.. prolly a .dll or something // Base.copyFile(exportFile, new File(destFolder, exportName)); // } - } else if (exportPlatform == PConstants.MACOSX) { - Base.copyFile(exportFile, new File(jarFolder, exportName)); - + + // first 2.0a2 attempt, until below... +// } else if (exportPlatform == PConstants.MACOSX) { +// Base.copyFile(exportFile, new File(jarFolder, exportName)); +// +// } else { +// Base.copyFile(exportFile, new File(destFolder, exportName)); } else { - Base.copyFile(exportFile, new File(destFolder, exportName)); + // Starting with 2.0a2 put extra export files (DLLs, plugins folder, + // anything else for libraries) inside lib or Contents/Resources/Java + Base.copyFile(exportFile, new File(jarFolder, exportName)); } } } @@ -1371,7 +1390,7 @@ public class JavaBuild { // another fix for bug #234, LD_LIBRARY_PATH ignored on some platforms //ps.print("LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APPDIR\n"); pw.print("java " + Preferences.get("run.options") + - " -Djava.library.path=\"$APPDIR\"" + + " -Djava.library.path=\"$APPDIR:$APPDIR\\lib\"" + " -cp \"" + exportClassPath + "\"" + " " + sketch.getName() + "\n"); diff --git a/build/windows/export/launcher.cpp b/build/windows/export/launcher.cpp index 7bd2e0aa6..f3748c415 100644 --- a/build/windows/export/launcher.cpp +++ b/build/windows/export/launcher.cpp @@ -281,6 +281,11 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) strcpy(outgoing_cmd_line, java_args); strcat(outgoing_cmd_line, " "); + // for 2.0a2, add the 'lib' folder to the java.library.path + strcat(outgoing_cmd_line, "-Djava.library.path="); + strcat(outgoing_cmd_line, exe_directory); + strcat(outgoing_cmd_line, "\\lib "); + // add the name of the class to execute and a space before the next arg strcat(outgoing_cmd_line, java_main_class); strcat(outgoing_cmd_line, " "); @@ -295,9 +300,10 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) // exe_directory is the name path to the current application if (local_jre_installed) { - strcpy(executable, exe_directory); + //strcpy(executable, exe_directory); // copy in the path for javaw, relative to launcher.exe - strcat(executable, "\\java\\bin\\javaw.exe"); + //strcat(executable, "\\java\\bin\\javaw.exe"); + sprintf(executable, "%s\\java\\bin\\javaw.exe", exe_directory); } else { strcpy(executable, "javaw.exe"); } diff --git a/todo.txt b/todo.txt index 07e260084..0c27839d9 100644 --- a/todo.txt +++ b/todo.txt @@ -6,6 +6,10 @@ X swap order of applet/application in the file menu X update Quaqua to 7.4.2 X make application the default instead of applet X subfolders of windows32 & friends aren't being included (gsvideo problem) +X on Windows, move the exported DLLs et al inside 'lib' +X requires change to export/launcher.cpp to include the exe dir +_ this will cause trouble with ... +X change Linux script to handle the 'lib' dir as part of the lib path _ add a preferences option for whether to run in 32 or 64-bit _ also make note of when library is not available (serial) with error msg