Skip to content

Commit 6eb3b14

Browse files
committed
Application export JDK and resources
1 parent 6df3bd4 commit 6eb3b14

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"JRELoadError" = "Unable to load Java Runtime Environment.";
2+
"JRExLoadError" = "Unable to load a Java %d Runtime Environment.";
3+
"JRExLoadFullError" = "This application requires that Java %d or later be installed on your computer. Please download and install the latest version of Java from www.java.com and try again.";
4+
"JDKxLoadFullError" = "This application requires that a Java %d JDK or later be installed on your computer. Please download and install the latest Java JDK from Oracle.com and try again.";
5+
"MainClassNameRequired" = "Main class name is required.";
6+
"JavaDirectoryNotFound" = "Unable to enumerate Java directory contents.";
7+
"BundlePathContainsColon" = "Cannot launch from folder that contains a \"/\" in its name.";

java/src/processing/mode/java/JavaBuild.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package processing.mode.java;
2525

2626
import java.io.*;
27+
import java.nio.file.Files;
2728
import java.util.*;
2829
import java.util.zip.ZipEntry;
2930
import java.util.zip.ZipFile;
@@ -732,7 +733,8 @@ protected boolean exportApplication(File destFolder,
732733
writer.println("APPL????");
733734
writer.flush();
734735
writer.close();
735-
if(System.getProperty("compose.application.resources.dir") == null) {
736+
var resources = System.getProperty("compose.application.resources.dir");
737+
if(resources == null) {
736738
// Use faster(?) native copy here (also to do sym links)
737739
if (embedJava) {
738740
Util.copyDirNative(new File(contentsOrig, "PlugIns"),
@@ -744,6 +746,29 @@ protected boolean exportApplication(File destFolder,
744746
new File(resourcesFolder, "en.lproj"));
745747
Util.copyFile(mode.getContentFile("application/application.icns"),
746748
new File(resourcesFolder, "application.icns"));
749+
}else{
750+
if(embedJava){
751+
try {
752+
var jdk = Files.list(new File(resources).toPath())
753+
.filter(Files::isDirectory)
754+
.filter(p -> p.getFileName().toString().startsWith("jdk-"))
755+
.findFirst()
756+
.orElseThrow();
757+
var target = new File(contentsFolder, "PlugIns/");
758+
target.mkdirs();
759+
Util.copyDirNative(jdk.toFile(), target);
760+
} catch (IOException e) {
761+
e.printStackTrace();
762+
}
763+
764+
Util.copyDir(new File(resources, "modes/java/application/en.lproj"),
765+
new File(contentsFolder, "Resources/en.lproj"));
766+
Util.copyFile(new File(resources, "modes/java/application/application.icns"),
767+
new File(contentsFolder, "Resources/application.icns"));
768+
769+
770+
}
771+
747772
}
748773
// TODO: Handle the java embed and Icon with the new build system
749774

0 commit comments

Comments
 (0)