mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
more consistency to Java version numbering
This commit is contained in:
@@ -187,7 +187,7 @@ public class ContributionManager {
|
||||
msg = "This item is not compatible with this version of Processing";
|
||||
} else if (cause instanceof UnsupportedClassVersionError) {
|
||||
msg = "This item needs to be recompiled for Java " +
|
||||
PApplet.javaVersionShort;
|
||||
PApplet.javaPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ import java.awt.image.BufferedImage;
|
||||
|
||||
|
||||
|
||||
|
||||
// used by loadImage() functions
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFileChooser;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
// used by desktopFile() method
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
@@ -109,12 +109,22 @@ public class PApplet implements PConstants {
|
||||
static public final String javaVersionName =
|
||||
System.getProperty("java.version");
|
||||
|
||||
/** Short name of Java version, i.e. 1.8. */
|
||||
static public final String javaVersionShort =
|
||||
//javaVersionName.substring(0, 3);
|
||||
javaVersionName.substring(0, javaVersionName.indexOf(".", 2));
|
||||
// can't use this one, it's 1.8.0 and breaks things
|
||||
//javaVersionName.substring(0, javaVersionName.indexOf("_"));
|
||||
// /** Short name of Java version, i.e. 1.8. */
|
||||
// static public final String javaVersionShort =
|
||||
// //javaVersionName.substring(0, 3);
|
||||
// javaVersionName.substring(0, javaVersionName.indexOf(".", 2));
|
||||
// // can't use this one, it's 1.8.0 and breaks things
|
||||
// //javaVersionName.substring(0, javaVersionName.indexOf("_"));
|
||||
|
||||
static public final int javaPlatform =
|
||||
PApplet.parseInt(PApplet.split(javaVersionName, '.')[1]);
|
||||
// static {
|
||||
// try {
|
||||
// javaPlatform = PApplet.split(javaVersionName, '.')[1];
|
||||
// } catch (Exception e) {
|
||||
// javaPlatform = "8"; // set a default in case
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Version of Java that's in use, whether 1.1 or 1.3 or whatever,
|
||||
@@ -127,9 +137,17 @@ public class PApplet implements PConstants {
|
||||
* (i.e. 1.40000001). This could just be a double, but since Processing
|
||||
* only uses floats, it's safer as a float because specifying a double
|
||||
* (with this narrow case especially) with the preprocessor is awkward.
|
||||
* <p>
|
||||
* @deprecated Java 10 is around the corner. Use javaPlatform when you need
|
||||
* a number for comparisons, i.e. "if (javaPlatform >= 7)".
|
||||
*/
|
||||
@Deprecated
|
||||
public static final float javaVersion =
|
||||
new Float(javaVersionShort).floatValue();
|
||||
new Float(javaVersionName.substring(0, 3));
|
||||
// public static final float javaVersion =
|
||||
// new Float(javaVersionName.substring(0, javaVersionName.indexOf(".", 2))).floatValue();
|
||||
// // Making this a String in 3.0, in anticipation of Java 10
|
||||
// public static final String javaVersion = "1." + javaPlatform;
|
||||
|
||||
/**
|
||||
* Current platform in use, one of the
|
||||
|
||||
@@ -5,6 +5,8 @@ X https://github.com/processing/processing/issues/3347
|
||||
X show warning when display spanning is turned off with fullScreen(SPAN)
|
||||
X defaults read com.apple.spaces spans-displays
|
||||
X https://github.com/processing/processing/issues/3381
|
||||
_ note that full screen and present are now different
|
||||
_ on Export to Application, this has an impact
|
||||
|
||||
cleaning
|
||||
o possible addition for 'implementation' variable
|
||||
|
||||
@@ -825,8 +825,6 @@ public class JavaEditor extends Editor {
|
||||
platformName = "Linux (" + Base.getNativeBits() + "-bit)";
|
||||
}
|
||||
|
||||
final String javaPlatform =
|
||||
PApplet.split(System.getProperty("java.version"), '.')[1];
|
||||
boolean embed = Preferences.getBoolean("export.application.embed_java");
|
||||
final String embedWarning =
|
||||
"<html><div width=\"" + divWidth + "\"><font size=\"2\">" +
|
||||
@@ -834,12 +832,12 @@ public class JavaEditor extends Editor {
|
||||
"Embedding Java will make the " + platformName + " application " +
|
||||
"larger, but it will be far more likely to work. " +
|
||||
"Users on other platforms will need to " +
|
||||
"<a href=\"\">install Java " + PApplet.javaVersionShort + "</a>.";
|
||||
"<a href=\"\">install Java " + PApplet.javaPlatform + "</a>.";
|
||||
final String nopeWarning =
|
||||
"<html><div width=\"" + divWidth + "\"><font size=\"2\">" +
|
||||
// "<html><body><font size=2>" +
|
||||
"Users on all platforms will have to install the latest " +
|
||||
"version of Java " + javaPlatform +
|
||||
"version of Java " + PApplet.javaPlatform +
|
||||
" from <a href=\"\">http://java.com/download</a>. " +
|
||||
"<br/> ";
|
||||
//"from <a href=\"http://java.com/download\">java.com/download</a>.";
|
||||
|
||||
Reference in New Issue
Block a user