diff -r 756be4fb5c3b installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/Bundle.properties
--- a/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/Bundle.properties Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/Bundle.properties Tue Dec 18 19:06:16 2012 +0100
@@ -51,3 +51,4 @@
NBP.browse.button.text=Br&owse...
NBP.warning.install.into.userdir=It is not recommended to install NetBeans into folder which is commonly used to store its settings ({0}).
+NBP.warning.jdk.not.recommended.version=This JDK version is older than the recommended JDK 7u10. For stability reasons we recommend that you download and install the latest JDK 7 update from {0} and restart NetBeans installer.
diff -r 756be4fb5c3b installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/NbBasePanel.java
--- a/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/NbBasePanel.java Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/NbBasePanel.java Tue Dec 18 19:06:16 2012 +0100
@@ -51,18 +51,20 @@
import javax.swing.JFileChooser;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.event.HyperlinkListener;
import org.netbeans.installer.product.Registry;
import org.netbeans.installer.product.components.Product;
import org.netbeans.installer.utils.BrowserUtils;
import org.netbeans.installer.utils.FileUtils;
-import org.netbeans.installer.utils.helper.swing.NbiButton;
-import org.netbeans.installer.utils.helper.swing.NbiLabel;
import org.netbeans.installer.utils.ResourceUtils;
import org.netbeans.installer.utils.StringUtils;
import org.netbeans.installer.utils.SystemUtils;
+import org.netbeans.installer.utils.helper.Text;
import org.netbeans.installer.utils.helper.Version;
+import org.netbeans.installer.utils.helper.swing.NbiButton;
import org.netbeans.installer.utils.helper.swing.NbiComboBox;
import org.netbeans.installer.utils.helper.swing.NbiDirectoryChooser;
+import org.netbeans.installer.utils.helper.swing.NbiLabel;
import org.netbeans.installer.utils.helper.swing.NbiTextField;
import org.netbeans.installer.utils.helper.swing.NbiTextPane;
import org.netbeans.installer.wizard.components.panels.ApplicationLocationPanel.LocationValidator;
@@ -71,9 +73,9 @@
import org.netbeans.installer.wizard.components.panels.DestinationPanel;
import org.netbeans.installer.wizard.components.panels.DestinationPanel.DestinationPanelUi;
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
+import org.netbeans.installer.wizard.containers.SwingContainer;
import org.netbeans.installer.wizard.ui.SwingUi;
import org.netbeans.installer.wizard.ui.WizardUi;
-import org.netbeans.installer.wizard.containers.SwingContainer;
/**
*
@@ -103,6 +105,8 @@
DEFAULT_BROWSE_BUTTON_TEXT);
setProperty(WARNING_INSTALL_INTO_USERDIR_PROPERTY,
DEFAULT_WARNING_INSTALL_INTO_USERDIR);
+ setProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION,
+ DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION);
}
@Override
@@ -229,6 +233,7 @@
this.panel = panel;
}
+ @Override
public SwingUi getSwingUi(SwingContainer container) {
if (swingUi == null) {
swingUi = new NbBaseDestinationPanelSwingUi(panel, container);
@@ -250,6 +255,9 @@
private NbiDirectoryChooser fileChooser;
+ private Text jdkWarningMessage = null;
+ private HyperlinkListener hyperlinkListener = null;
+
public NbBaseDestinationPanelSwingUi(
final NbBasePanel panel,
final SwingContainer container) {
@@ -268,7 +276,7 @@
final JdkLocationPanel jdkLocationPanel = panel.getJdkLocationPanel();
- if (jdkLocationPanel.getLocations().size() == 0) {
+ if (jdkLocationPanel.getLocations().isEmpty()) {
final Version minVersion = Version.getVersion(jdkLocationPanel.getProperty(
JdkLocationPanel.MINIMUM_JDK_VERSION_PROPERTY));
final Version maxVersion = Version.getVersion(jdkLocationPanel.getProperty(
@@ -281,7 +289,7 @@
maxVersion.toJdkStyle(),
jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY)));
- statusLabel.addHyperlinkListener(BrowserUtils.createHyperlinkListener());
+ statusLabel.addHyperlinkListener(getHyperlinkListener());
} else {
statusLabel.clearText();
statusLabel.setVisible(false);
@@ -356,14 +364,17 @@
jdkLocationField = new NbiTextField();
jdkLocationField.getDocument().addDocumentListener(
new DocumentListener() {
+ @Override
public void insertUpdate(DocumentEvent e) {
updateErrorMessage();
}
+ @Override
public void removeUpdate(DocumentEvent e) {
// updateErrorMessage();
}
+ @Override
public void changedUpdate(DocumentEvent e) {
updateErrorMessage();
}
@@ -371,8 +382,20 @@
// jdkLocationComboBox //////////////////////////////////////////////////
final LocationValidator validator = new LocationValidator() {
+ @Override
public void validate(String location) {
jdkLocationField.setText(location);
+
+ if (!panel.jdkLocationPanel.isJdkVersionRecommended(location)) {
+ statusLabel.setText(getJdkWarningMessage());
+ if (statusLabel.getHyperlinkListeners().length == 0) {
+ statusLabel.addHyperlinkListener(getHyperlinkListener());
+ }
+ statusLabel.setVisible(true);
+ } else {
+ statusLabel.clearText();
+ statusLabel.setVisible(false);
+ }
}
};
@@ -380,6 +403,7 @@
jdkLocationComboBox.setEditable(true);
jdkLocationComboBox.setEditor(new LocationsComboBoxEditor(validator));
jdkLocationComboBox.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent event) {
final ComboBoxModel model = jdkLocationComboBox.getModel();
@@ -397,6 +421,7 @@
// browseButton /////////////////////////////////////////////////////////
browseButton = new NbiButton();
browseButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent event) {
browseButtonPressed();
}
@@ -443,6 +468,25 @@
0, 0)); // padx, pady - ???
}
+ private Text getJdkWarningMessage() {
+ if (jdkWarningMessage == null) {
+ String messageContent = StringUtils.format(
+ panel.getProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION),
+ panel.jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY));
+ jdkWarningMessage = new Text(messageContent, Text.ContentType.HTML);
+ }
+
+ return jdkWarningMessage;
+ }
+
+ private HyperlinkListener getHyperlinkListener() {
+ if (hyperlinkListener == null) {
+ hyperlinkListener = BrowserUtils.createHyperlinkListener();
+ }
+
+ return hyperlinkListener;
+ }
+
private void browseButtonPressed() {
fileChooser.setSelectedFile(new File(jdkLocationField.getText().trim()));
@@ -461,6 +505,8 @@
"browse.button.text"; // NOI18N
public static final String WARNING_INSTALL_INTO_USERDIR_PROPERTY =
"install.into.userdir.storage";
+ public static final String WARNING_JDK_NOT_RECOMMENDED_VERSION =
+ "jdk.not.recommended.version";
public static final String DEFAULT_TITLE =
ResourceUtils.getString(NbBasePanel.class,
@@ -492,4 +538,7 @@
public static final String DEFAULT_WARNING_INSTALL_INTO_USERDIR =
ResourceUtils.getString(NbBasePanel.class,
"NBP.warning.install.into.userdir"); // NOI18N
+ public static final String DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION =
+ ResourceUtils.getString(NbBasePanel.class,
+ "NBP.warning.jdk.not.recommended.version"); // NOI18N
}
diff -r 756be4fb5c3b installer/mac/newbuild/Bundle.properties
--- a/installer/mac/newbuild/Bundle.properties Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/Bundle.properties Tue Dec 18 19:06:16 2012 +0100
@@ -93,4 +93,10 @@
ERR_INVALID_VERSION_MSG=This software can be installed only on Mac OS X v10.4-based system and later.
ERR_NO_JAVA_TITLE=No Java software was found on the system
-ERR_NO_JAVA_MSG=This software can be installed and can work with Java 6 and later versions. Please download and install Java 6 for your system from http://support.apple.com/downloads or Java 7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
+ERR_NO_JAVA_MSG=NetBeans 7.3 cannot be installed on this disk. This software can be installed with Java 6 or Java 7 update 10 or newer. Please download and install the latest update of Java 7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.NetBeans 7.3 cannot be installed on this disk.
+
+WARN_JAVA6_OLDER_JAVA7_TITLE=Unsupported version of Java 7
+WARN_JAVA6_OLDER_JAVA7_MSG=NetBeans 7.3 will be installed on this disk with Java 6. For the Java 7 to be used with NetBeans, it is required that Java 7u10 or newer is installed. Please download and install the latest update of Java 7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation if you want to use NetBeans with Java 7.
+
+ERR_OLDER_JAVA7_TITLE=Unsupported update of Java 7
+ERR_OLDER_JAVA7_MSG=NetBeans 7.3 cannot be installed on this disk. This software can be installed with Java 6 or Java 7 update 10 or newer. Please download and install the latest update of Java 7 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.
\ No newline at end of file
diff -r 756be4fb5c3b installer/mac/newbuild/dmg/distribution-cpp.dist
--- a/installer/mac/newbuild/dmg/distribution-cpp.dist Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/dmg/distribution-cpp.dist Tue Dec 18 19:06:16 2012 +0100
@@ -5,16 +5,23 @@
-
+
-
-
diff -r 756be4fb5c3b installer/mac/newbuild/dmg/distribution-javaee.dist
--- a/installer/mac/newbuild/dmg/distribution-javaee.dist Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/dmg/distribution-javaee.dist Tue Dec 18 19:06:16 2012 +0100
@@ -5,16 +5,23 @@
-
+
-
-
diff -r 756be4fb5c3b installer/mac/newbuild/dmg/distribution-javase.dist
--- a/installer/mac/newbuild/dmg/distribution-javase.dist Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/dmg/distribution-javase.dist Tue Dec 18 19:06:16 2012 +0100
@@ -5,16 +5,23 @@
-
+
-
-
diff -r 756be4fb5c3b installer/mac/newbuild/dmg/distribution-php.dist
--- a/installer/mac/newbuild/dmg/distribution-php.dist Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/dmg/distribution-php.dist Tue Dec 18 19:06:16 2012 +0100
@@ -5,16 +5,23 @@
-
+
-
-
diff -r 756be4fb5c3b installer/mac/newbuild/dmg/distribution.dist
--- a/installer/mac/newbuild/dmg/distribution.dist Tue Dec 18 17:44:28 2012 +0100
+++ b/installer/mac/newbuild/dmg/distribution.dist Tue Dec 18 19:06:16 2012 +0100
@@ -5,16 +5,23 @@
-
+
-
-
-
-
+
diff -r 756be4fb5c3b nbi/engine/src/org/netbeans/installer/utils/applications/JavaUtils.java
--- a/nbi/engine/src/org/netbeans/installer/utils/applications/JavaUtils.java Tue Dec 18 17:44:28 2012 +0100
+++ b/nbi/engine/src/org/netbeans/installer/utils/applications/JavaUtils.java Tue Dec 18 19:06:16 2012 +0100
@@ -45,21 +45,20 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.netbeans.installer.utils.ErrorManager;
+import org.netbeans.installer.utils.FileProxy;
import org.netbeans.installer.utils.LogManager;
import org.netbeans.installer.utils.ResourceUtils;
-import org.netbeans.installer.utils.helper.ExecutionResults;
-import org.netbeans.installer.utils.FileProxy;
-import org.netbeans.installer.utils.ErrorManager;
import org.netbeans.installer.utils.StringUtils;
import org.netbeans.installer.utils.SystemUtils;
import org.netbeans.installer.utils.exceptions.DownloadException;
import org.netbeans.installer.utils.exceptions.NativeException;
+import org.netbeans.installer.utils.helper.ExecutionResults;
import org.netbeans.installer.utils.helper.Version;
import org.netbeans.installer.utils.system.WindowsNativeUtils;
+import org.netbeans.installer.utils.system.windows.WindowsRegistry;
+import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
-import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
-import static org.netbeans.installer.utils.system.windows.WindowsRegistry.SEPARATOR;
-import org.netbeans.installer.utils.system.windows.WindowsRegistry;
/**
*
@@ -131,16 +130,24 @@
return true;
}
+
+ public static boolean isRecommended(Version version) {
+ /*to and from versions - not recommended - all JDK 7 versions older than 7u10 */
+ return version.olderThan(criticalLowVersion) || version.newerThan(criticalHighVersion);
+ }
+
public static void addJavaInfo(final File location, final JavaInfo info) {
if(knownJdks.get(location)==null) {
knownJdks.put(location, info);
}
}
+
public static void removeJavaInfo(final File location) {
if(knownJdks.get(location)!=null) {
knownJdks.remove(location);
}
}
+
public static Version getVersion(File javaHome) {
final JavaInfo info = getInfo(javaHome);
@@ -270,7 +277,7 @@
LogManager.log("... checking if JDK " + version + " is already installed");
WindowsRegistry winreg = ((WindowsNativeUtils) SystemUtils.getNativeUtils()).getWindowsRegistry();
if(winreg.keyExists(HKLM, javaKey, version)) {
- final String versKey = javaKey + winreg.SEPARATOR + version;
+ final String versKey = javaKey + WindowsRegistry.SEPARATOR + version;
if(winreg.valueExists(HKLM, versKey, JAVAHOME_VALUE)) {
final String javaHome = winreg.getStringValue(HKLM, versKey,JAVAHOME_VALUE);
if(JavaUtils.getInfo(new File(javaHome))!=null) {
@@ -290,6 +297,7 @@
}
return result;
}
+
// private //////////////////////////////////////////////////////////////////////
private static int getJDKRegistrySection(WindowsRegistry registry) throws NativeException {
return (registry.canModifyKey(HKLM,JDK_KEY) ? HKLM : HKCU);
@@ -370,9 +378,9 @@
final String[] lines = StringUtils.splitByLines(string);
Version version = null;
- String vendor = null;
- String osName = null;
- String osArch = null;
+ String vendor;
+ String osName;
+ String osArch;
boolean nonFinal = false;
@@ -506,6 +514,9 @@
/////////////////////////////////////////////////////////////////////////////////
// Constants
+ public static Version criticalLowVersion = Version.getVersion("1.7.0_00");
+ public static Version criticalHighVersion = Version.getVersion("1.7.0_09");
+
public static final String JDK_KEY =
"SOFTWARE\\JavaSoft\\Java Development Kit"; // NOI18N
public static final String JRE_KEY =
diff -r 756be4fb5c3b nbi/engine/src/org/netbeans/installer/wizard/components/actions/SearchForJavaAction.java
--- a/nbi/engine/src/org/netbeans/installer/wizard/components/actions/SearchForJavaAction.java Tue Dec 18 17:44:28 2012 +0100
+++ b/nbi/engine/src/org/netbeans/installer/wizard/components/actions/SearchForJavaAction.java Tue Dec 18 19:06:16 2012 +0100
@@ -48,23 +48,18 @@
import java.util.List;
import org.netbeans.installer.product.Registry;
import org.netbeans.installer.product.components.Product;
-import org.netbeans.installer.utils.helper.ErrorLevel;
-import org.netbeans.installer.utils.ErrorManager;
-import org.netbeans.installer.utils.FileUtils;
-import org.netbeans.installer.utils.LogManager;
-import org.netbeans.installer.utils.ResourceUtils;
-import org.netbeans.installer.utils.StringUtils;
-import org.netbeans.installer.utils.SystemUtils;
+import org.netbeans.installer.utils.*;
import org.netbeans.installer.utils.applications.JavaUtils;
import org.netbeans.installer.utils.applications.JavaUtils.JavaInfo;
import org.netbeans.installer.utils.exceptions.NativeException;
+import org.netbeans.installer.utils.helper.ErrorLevel;
import org.netbeans.installer.utils.helper.Status;
import org.netbeans.installer.utils.helper.Version;
import org.netbeans.installer.utils.progress.Progress;
import org.netbeans.installer.utils.system.WindowsNativeUtils;
import org.netbeans.installer.utils.system.windows.WindowsRegistry;
+import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
-import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
import org.netbeans.installer.wizard.components.WizardAction;
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
@@ -83,9 +78,11 @@
setProperty(DESCRIPTION_PROPERTY, DEFAULT_DESCRIPTION);
}
+ @Override
public void execute() {
execute(new Progress());
}
+
public void execute(Progress progress) {
LogManager.logEntry("search for all java locations");
getWizardUi().setProgress(progress);
@@ -113,10 +110,12 @@
SystemUtils.sleep(200);
LogManager.logExit("... end of search for all java locations");
}
+
@Override
public boolean canExecuteForward() {
- return javaLocations.size() == 0;
+ return javaLocations.isEmpty();
}
+
// private //////////////////////////////////////////////////////////////////////
private static String getLabel(File javaHome) {
JavaInfo javaInfo = JavaUtils.getInfo(javaHome);
@@ -203,10 +202,11 @@
}
}
+
public static void sortJavaLocations(){
// sort the found java installations:
// 1) by final/non-final
- // 2) by version descending
+ // 2) by version descending (6 has priority over 7u9 and older)
// 3) by path acending
// 4) by vendor descending (so Sun comes first, hehe)
for (int i = 0; i < javaLocations.size(); i++) {
@@ -219,27 +219,36 @@
JavaInfo info1 = JavaUtils.getInfo(javaLocations.get(j));
JavaInfo info2 = JavaUtils.getInfo(javaLocations.get(j - 1));
-
+
if (info1.isNonFinal() == info2.isNonFinal()) {
- if (info1.getVersion().equals(info2.getVersion())) {
- if (file1.getPath().compareTo(file2.getPath()) == 0) {
- if (info1.getVendor().compareTo(info2.getVendor()) == 0) {
- continue;
- } else if (info1.getVendor().compareTo(info2.getVendor()) < 0) {
+ if (JavaUtils.isRecommended(info1.getVersion()) == JavaUtils.isRecommended(info2.getVersion())) {
+ if (info1.getVersion().equals(info2.getVersion())) {
+ // better than compare directly archs is to compare if archs are both 64bit
+ if (info1.getArch().endsWith("64") == info2.getArch().endsWith("64")) {
+ if (file1.getPath().compareTo(file2.getPath()) == 0) {
+ if (info1.getVendor().compareTo(info2.getVendor()) == 0) {
+ continue;
+ } else if (info1.getVendor().compareTo(info2.getVendor()) < 0) {
+ switchNeighbours(j, file2, file1, label2, label1);
+ }
+ } else if (file1.getPath().length() < file2.getPath().length()) {
+ switchNeighbours(j, file2, file1, label2, label1);
+ }
+ } else if (info1.getArch().endsWith("64") && !info2.getArch().endsWith("64")) {
switchNeighbours(j, file2, file1, label2, label1);
}
- } else if (file1.getPath().length() < file2.getPath().length()) {
+ } else if (info1.getVersion().newerThan(info2.getVersion())) {
switchNeighbours(j, file2, file1, label2, label1);
}
- } else if (info1.getVersion().newerThan(info2.getVersion())) {
+ } else if (JavaUtils.isRecommended(info1.getVersion()) && !JavaUtils.isRecommended(info2.getVersion())) {
switchNeighbours(j, file2, file1, label2, label1);
- }
+ }
} else if (!info1.isNonFinal() && info2.isNonFinal()) {
switchNeighbours(j, file2, file1, label2, label1);
}
}
}
- }
+ }
private static void switchNeighbours (int j, File file2, File file1, String label2, String label1) {
javaLocations.set(j, file2);
@@ -265,6 +274,7 @@
javaLabels.add(getLabel(javaHome));
}
}
+
public static List getJavaLocations() {
return javaLocations;
}
@@ -328,6 +338,7 @@
final boolean isWindows = SystemUtils.isWindows();
final boolean isSolaris = SystemUtils.isSolaris();
final File[] children = parent.listFiles(new FileFilter() {
+ @Override
public boolean accept(final File pathname) {
return pathname.isDirectory() &&
(!isSolaris || !pathname.equals(new File("/export/sybase"))) && //workaround for #143292
@@ -463,6 +474,7 @@
}
}
}
+
/////////////////////////////////////////////////////////////////////////////////
// Constants
public static final String DEFAULT_TITLE =
@@ -536,8 +548,7 @@
"/usr/java/jdk", // NOI18N
"/usr/j2se", // NOI18N
"/usr/j2sdk", // NOI18N
-
-
+
"/usr/local", // NOI18N
"/usr/local/jdk", // NOI18N
"/usr/local/jdk/instances", // NOI18N
diff -r 756be4fb5c3b nbi/engine/src/org/netbeans/installer/wizard/components/panels/Bundle.properties
--- a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/Bundle.properties Tue Dec 18 17:44:28 2012 +0100
+++ b/nbi/engine/src/org/netbeans/installer/wizard/components/panels/Bundle.properties Tue Dec 18 19:06:16 2012 +0100
@@ -131,7 +131,7 @@
JLP.error.wrong.vendor.java=The specified Java environment folder contains Java from the unsupported vendor ({1}). The supported vendors are "{2}".
JLP.error.unknown=An unknown error occured while validating the path.
#NOI18N
-JLP.java.download.page=http://java.sun.com/javase/downloads
+JLP.java.download.page=http://www.oracle.com/technetwork/java/javase/downloads/
#NOI18N
JLP.java.download.page.mac=http://developer.apple.com/java/download
JLP.error.nothing.found=\
diff -r 756be4fb5c3b nbi/engine/src/org/netbeans/installer/wizard/components/panels/ErrorMessagePanel.java
--- a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/ErrorMessagePanel.java Tue Dec 18 17:44:28 2012 +0100
+++ b/nbi/engine/src/org/netbeans/installer/wizard/components/panels/ErrorMessagePanel.java Tue Dec 18 19:06:16 2012 +0100
@@ -51,12 +51,12 @@
import org.netbeans.installer.utils.UiUtils;
import org.netbeans.installer.utils.helper.NbiThread;
import org.netbeans.installer.utils.helper.swing.NbiLabel;
-import org.netbeans.installer.wizard.ui.SwingUi;
-import org.netbeans.installer.wizard.ui.WizardUi;
import org.netbeans.installer.wizard.components.WizardPanel;
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelSwingUi;
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelUi;
import org.netbeans.installer.wizard.containers.SwingContainer;
+import org.netbeans.installer.wizard.ui.SwingUi;
+import org.netbeans.installer.wizard.ui.WizardUi;
/**
*
@@ -234,7 +234,7 @@
}
}
- protected String getWarningMessage() {
+ protected String getWarningMessage() {
return null;
}
@@ -295,8 +295,8 @@
// private //////////////////////////////////////////////////////////////////
private void initComponents() {
// errorLabel ///////////////////////////////////////////////////////////
- errorLabel = new NbiLabel();
-
+ errorLabel = new NbiLabel();
+
// this /////////////////////////////////////////////////////////////////
add(errorLabel, new GridBagConstraints(
0, 99, // x, y
diff -r 756be4fb5c3b nbi/engine/src/org/netbeans/installer/wizard/components/panels/JdkLocationPanel.java
--- a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/JdkLocationPanel.java Tue Dec 18 17:44:28 2012 +0100
+++ b/nbi/engine/src/org/netbeans/installer/wizard/components/panels/JdkLocationPanel.java Tue Dec 18 19:06:16 2012 +0100
@@ -245,10 +245,12 @@
jreAllowed ? DEFAULT_ERROR_NOTHING_FOUND_JAVA : DEFAULT_ERROR_NOTHING_FOUND);
}
+ @Override
public List getLocations() {
return jdkLocations;
}
+ @Override
public List getLabels() {
return jdkLabels;
}
@@ -257,6 +259,7 @@
return "true".equals(getProperty(JRE_ALLOWED_PROPERTY));
}
+ @Override
public File getSelectedLocation() {
// the first obvious choice is the jdk that has already been selected for
// this product; if it has not yet been set, there are still lots of
@@ -321,7 +324,7 @@
}
private File getJavaFirstItemInTheList() {
- if(jdkLocations.size() == 0) {
+ if(jdkLocations.isEmpty()) {
return null;
}
if(isJreAllowed()) {
@@ -459,6 +462,7 @@
return closestLocation;
}
+ @Override
public String validateLocation(final String path) {
final File file = new File(path);
@@ -471,8 +475,7 @@
return StringUtils.format(
getProperty(ERROR_NOT_VALID_PATH_PROPERTY), path);
}
-
-
+
if (!file.exists()) {
if(JavaUtils.getInfo(file)==null) {
// JDK location does not exist and is not in the list of installable JDKs
@@ -488,22 +491,14 @@
if (!isJreAllowed() && !JavaUtils.isJdk(file)) {
return StringUtils.format(
getProperty(ERROR_NOT_JDK_PROPERTY), path);
- }
- }
+ }
+ }
- Version version = JavaUtils.getVersion(file);
- if (version == null) {
- for (Product jdk: Registry.getInstance().getProducts(JDK_PRODUCT_UID)) {
- if ((jdk.getStatus() == Status.TO_BE_INSTALLED) &&
- jdk.getInstallationLocation().equals(file)) {
- version = jdk.getVersion();
- }
- }
- }
+ Version version = getVersion(file);
if (version == null) {
return StringUtils.format(getProperty(ERROR_UNKNOWN_PROPERTY), path);
- }
+ }
if (version.olderThan(minimumVersion)) {
return StringUtils.format(
@@ -519,7 +514,8 @@
path,
version,
maximumVersion);
- }
+ }
+
String vendor = JavaUtils.getInfo(file).getVendor();
if(!vendor.matches(vendorAllowed)) {
return StringUtils.format(
@@ -530,14 +526,41 @@
}
return null;
- }
+ }
+ @Override
public void setLocation(final File location) {
lastSelectedJava = location;
SearchForJavaAction.addJavaLocation(location);
getWizard().setProperty(JDK_LOCATION_PROPERTY, location.getAbsolutePath());
}
+ /**
+ * Returns if JDK version is recommended - #218822
+ * @param jdkPath
+ * @return false if not recommended. If JDK does not exist returns true.
+ */
+ public boolean isJdkVersionRecommended(String jdkPath) {
+ File jdkFile = new File(jdkPath);
+ Version version = getVersion(jdkFile);
+
+ return version != null ? JavaUtils.isRecommended(version) : true;
+ }
+
+ private Version getVersion(File file) {
+ Version version = JavaUtils.getVersion(file);
+
+ if (version == null) {
+ for (Product jdk : Registry.getInstance().getProducts(JDK_PRODUCT_UID)) {
+ if ((jdk.getStatus() == Status.TO_BE_INSTALLED) && jdk.getInstallationLocation().equals(file)) {
+ version = jdk.getVersion();
+ }
+ }
+ }
+
+ return version;
+ }
+
private void addJavaLocationsFromProductDependencies() {
// finally we should scan the registry for jdks planned for installation, if
// the current product is scheduled to be installed after 'jdk', i.e. has
diff -r 756be4fb5c3b o.n.bootstrap/launcher/unix/nbexec
--- a/o.n.bootstrap/launcher/unix/nbexec Tue Dec 18 17:44:28 2012 +0100
+++ b/o.n.bootstrap/launcher/unix/nbexec Tue Dec 18 19:06:16 2012 +0100
@@ -153,11 +153,14 @@
Darwin*)
# read Java Preferences
if [ -x "/usr/libexec/java_home" ]; then
- jdkhome=`/usr/libexec/java_home --version 1.6+`
+ jdkhome=`/usr/libexec/java_home --version 1.7.0_10+ --failfast`
+ if [ -z $jdkhome ]; then
+ jdkhome=`/usr/libexec/java_home --version 1.6 --failfast`
+ fi
- # JDK1.7
- elif [ -f "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java" ] ; then
- jdkhome="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"
+ # JDK1.7 Update 10 as a fallback
+ elif [ -f "/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java" ] ; then
+ jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home"
# JDK1.6
elif [ -f "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ; then
@@ -167,6 +170,7 @@
elif [ -f "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java" ] ; then
jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
fi
+ echo Found jdkhome=$jdkhome
;;
*) javac=`which javac`
if [ -z "$javac" ] ; then