Skip to content

Commit

Permalink
PDE running under linux but sketches fail on java path.
Browse files Browse the repository at this point in the history
As part of processing#5753 and processing#5750, working AdoptOpenJDK released java on
Elementary Linux 5.0 (Juno, 64bit). Linux 4.15.0-36-generic. Tested
with Java 11. JDK downloads working and PDE runs but sketches wont
execute due to broken java path.
  • Loading branch information
sampottinger committed Jan 16, 2019
1 parent 79f6353 commit e781f29
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 16 deletions.
32 changes: 25 additions & 7 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<property name="jdk.train" value="11" />
<property name="jdk.version" value="0" />
<property name="jdk.update" value="1" />
<property name="jdk.build" value="12" />
<property name="jdk.build" value="13" />
<!-- See https://gist.github.com/P7h/9741922
or http://stackoverflow.com/q/10268583 -->
<property name="jdk.hash" value="750e1c8617c5452694857ad95c3ee230" />
Expand Down Expand Up @@ -234,7 +234,7 @@
<target name="jre-download" depends="jre-check, downloader-setup"
unless="jre.tgz.downloaded">
<!-- we normally download a JRE, except on arm -->
<property name="jre.download.jdk" value="false" />
<property name="jre.download.jdk" value="true" />

<condition property="jre.downloader"
value="${platform}-i586.tar.gz">
Expand All @@ -245,7 +245,10 @@
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>

<downloader version="${jdk.version}"
<downloader train="${jdk.train}"
version="${jdk.version}"
openJdk="true"
platform="linux64"
update="${jdk.update}"
build="${jdk.build}"
hash="${jdk.hash}"
Expand Down Expand Up @@ -877,20 +880,35 @@
</exec>

<!-- use the jre subfolder when having downloaded a JDK file -->
<condition property="jre.dir" value="jdk${jdk.esoteric}/jre">
<condition property="jre.dir" value="jdk${jdk.esoteric}">
<!-- property might not be set, but it is for arm -->
<equals arg1="${jre.download.jdk}" arg2="true" />
<and>
<equals arg1="${jre.download.jdk}" arg2="true" />
<equals arg1="${jdk.train}" arg2="1" />
</and>
</condition>

<!-- use top level JRE otherwise -->
<condition property="jre.dir" value="jre${jdk.esoteric}">
<and>
<not>
<equals arg1="${jre.download.jdk}" arg2="true" />
</not>
<equals arg1="${jdk.train}" arg2="1" />
</and>
</condition>

<!-- Force full JDK when not on train 1 (force when on java 11) -->
<condition property="jre.dir" value="jdk-${jdk.esoteric}+${jdk.build}">
<not>
<equals arg1="${jre.download.jdk}" arg2="true" />
<equals arg1="${jdk.train}" arg2="1" />
</not>
</condition>

<exec executable="rsync" dir="linux">
<arg value="-a" />
<arg value="--delete" />
<arg value="${jre.dir}/" />
<arg value="${jre.dir}" />
<arg value="work/java/" />
</exec>

Expand Down
13 changes: 10 additions & 3 deletions build/jre/src/Downloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public class Downloader extends Task {

public Downloader() { }

private void setPlatform(String platform) {
public void setPlatform(String platform) {
this.platform = platform;
}

private void setOpenJdk(boolean openJdk) {
public void setOpenJdk(boolean openJdk) {
this.openJdk = openJdk;
}

Expand Down Expand Up @@ -80,7 +80,12 @@ public void setPath(String path) {


public void execute() throws BuildException {
if (version == 0) {
if (train == 0) {
throw new BuildException("Train (i.e. 1 or 11) must be set");
}

boolean isJava11 = train == 11;
if (!isJava11 && version == 0) {
throw new BuildException("Version (i.e. 7 or 8) must be set");
}

Expand Down Expand Up @@ -137,6 +142,8 @@ void download() throws IOException {
hash
);

System.out.println("Attempting download at " + url);

HttpURLConnection conn =
(HttpURLConnection) new URL(url).openConnection();
conn.setRequestProperty("Cookie", COOKIE);
Expand Down
8 changes: 4 additions & 4 deletions build/linux/processing
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh

# This script runs Processing, using the JRE in the Processing
# This script runs Processing, using the JRE in the Processing
# installation directory.

# If your system needs a different version of Java than what's included
# in the download, replace the 'java' folder with the contents of a new
# Oracle JRE (Java 8 only), or create a symlink named "java" in the
# Oracle JRE (Java 8 only), or create a symlink named "java" in the
# Processing installation directory that points to the JRE home directory.
# This must be a Sun/Oracle JDK. For more details, see here:
# https://github.com/processing/processing/wiki/Supported-Platforms
Expand Down Expand Up @@ -104,7 +104,7 @@ cmd_name='processing-java'

if [ $current_name = $cmd_name ]
then
java -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.mode.java.Commander "$@"
java -Djna.nosys=true -Xmx256m processing.mode.java.Commander "$@"
exit $?
else
# Start Processing in the same directory as this script
Expand All @@ -115,5 +115,5 @@ else
fi
cd "$APPDIR"

java -splash:lib/about-1x.png -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.app.Base "$SKETCH" &
java -splash:lib/about-1x.png -Djna.nosys=true -Xmx256m processing.app.Base "$SKETCH" &
fi
4 changes: 2 additions & 2 deletions java/src/processing/mode/java/runner/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ protected StringList getMachineParams() {
}
// sketch.libraryPath might be ""
// librariesClassPath will always have sep char prepended
params.append("-Djava.library.path=" +
/*params.append("-Djava.library.path=" +
build.getJavaLibraryPath() +
File.pathSeparator +
System.getProperty("java.library.path"));
System.getProperty("java.library.path"));*/

params.append("-cp");
params.append(build.getClassPath());
Expand Down

0 comments on commit e781f29

Please sign in to comment.