This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 218822
Collapse All | Expand All

(-)a/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/Bundle.properties (+1 lines)
Lines 51-53 Link Here
51
NBP.browse.button.text=Br&owse...
51
NBP.browse.button.text=Br&owse...
52
52
53
NBP.warning.install.into.userdir=It is not recommended to install NetBeans into folder which is commonly used to store its settings  ({0}).
53
NBP.warning.install.into.userdir=It is not recommended to install NetBeans into folder which is commonly used to store its settings  ({0}).
54
NBP.warning.jdk.not.recommended.version=<font color='red'>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 </font><a href=\"{0}\">{0}</a><font color='red'> and restart NetBeans installer.</font>
(-)a/installer/components/products/nb-base/src/org/netbeans/installer/products/nb/base/wizard/panels/NbBasePanel.java (-5 / +54 lines)
Lines 51-68 Link Here
51
import javax.swing.JFileChooser;
51
import javax.swing.JFileChooser;
52
import javax.swing.event.DocumentEvent;
52
import javax.swing.event.DocumentEvent;
53
import javax.swing.event.DocumentListener;
53
import javax.swing.event.DocumentListener;
54
import javax.swing.event.HyperlinkListener;
54
import org.netbeans.installer.product.Registry;
55
import org.netbeans.installer.product.Registry;
55
import org.netbeans.installer.product.components.Product;
56
import org.netbeans.installer.product.components.Product;
56
import org.netbeans.installer.utils.BrowserUtils;
57
import org.netbeans.installer.utils.BrowserUtils;
57
import org.netbeans.installer.utils.FileUtils;
58
import org.netbeans.installer.utils.FileUtils;
58
import org.netbeans.installer.utils.helper.swing.NbiButton;
59
import org.netbeans.installer.utils.helper.swing.NbiLabel;
60
import org.netbeans.installer.utils.ResourceUtils;
59
import org.netbeans.installer.utils.ResourceUtils;
61
import org.netbeans.installer.utils.StringUtils;
60
import org.netbeans.installer.utils.StringUtils;
62
import org.netbeans.installer.utils.SystemUtils;
61
import org.netbeans.installer.utils.SystemUtils;
62
import org.netbeans.installer.utils.helper.Text;
63
import org.netbeans.installer.utils.helper.Version;
63
import org.netbeans.installer.utils.helper.Version;
64
import org.netbeans.installer.utils.helper.swing.NbiButton;
64
import org.netbeans.installer.utils.helper.swing.NbiComboBox;
65
import org.netbeans.installer.utils.helper.swing.NbiComboBox;
65
import org.netbeans.installer.utils.helper.swing.NbiDirectoryChooser;
66
import org.netbeans.installer.utils.helper.swing.NbiDirectoryChooser;
67
import org.netbeans.installer.utils.helper.swing.NbiLabel;
66
import org.netbeans.installer.utils.helper.swing.NbiTextField;
68
import org.netbeans.installer.utils.helper.swing.NbiTextField;
67
import org.netbeans.installer.utils.helper.swing.NbiTextPane;
69
import org.netbeans.installer.utils.helper.swing.NbiTextPane;
68
import org.netbeans.installer.wizard.components.panels.ApplicationLocationPanel.LocationValidator;
70
import org.netbeans.installer.wizard.components.panels.ApplicationLocationPanel.LocationValidator;
Lines 71-79 Link Here
71
import org.netbeans.installer.wizard.components.panels.DestinationPanel;
73
import org.netbeans.installer.wizard.components.panels.DestinationPanel;
72
import org.netbeans.installer.wizard.components.panels.DestinationPanel.DestinationPanelUi;
74
import org.netbeans.installer.wizard.components.panels.DestinationPanel.DestinationPanelUi;
73
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
75
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
76
import org.netbeans.installer.wizard.containers.SwingContainer;
74
import org.netbeans.installer.wizard.ui.SwingUi;
77
import org.netbeans.installer.wizard.ui.SwingUi;
75
import org.netbeans.installer.wizard.ui.WizardUi;
78
import org.netbeans.installer.wizard.ui.WizardUi;
76
import org.netbeans.installer.wizard.containers.SwingContainer;
77
79
78
/**
80
/**
79
 *
81
 *
Lines 103-108 Link Here
103
                DEFAULT_BROWSE_BUTTON_TEXT);
105
                DEFAULT_BROWSE_BUTTON_TEXT);
104
        setProperty(WARNING_INSTALL_INTO_USERDIR_PROPERTY,
106
        setProperty(WARNING_INSTALL_INTO_USERDIR_PROPERTY,
105
                DEFAULT_WARNING_INSTALL_INTO_USERDIR);
107
                DEFAULT_WARNING_INSTALL_INTO_USERDIR);
108
        setProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION,
109
                DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION);
106
    }
110
    }
107
    
111
    
108
    @Override
112
    @Override
Lines 229-234 Link Here
229
            this.panel = panel;
233
            this.panel = panel;
230
        }
234
        }
231
        
235
        
236
        @Override
232
        public SwingUi getSwingUi(SwingContainer container) {
237
        public SwingUi getSwingUi(SwingContainer container) {
233
            if (swingUi == null) {
238
            if (swingUi == null) {
234
                swingUi = new NbBaseDestinationPanelSwingUi(panel, container);
239
                swingUi = new NbBaseDestinationPanelSwingUi(panel, container);
Lines 250-255 Link Here
250
        
255
        
251
        private NbiDirectoryChooser fileChooser;
256
        private NbiDirectoryChooser fileChooser;
252
        
257
        
258
        private Text jdkWarningMessage = null;
259
        private HyperlinkListener hyperlinkListener = null;
260
        
253
        public NbBaseDestinationPanelSwingUi(
261
        public NbBaseDestinationPanelSwingUi(
254
                final NbBasePanel panel,
262
                final NbBasePanel panel,
255
                final SwingContainer container) {
263
                final SwingContainer container) {
Lines 268-274 Link Here
268
            
276
            
269
            final JdkLocationPanel jdkLocationPanel = panel.getJdkLocationPanel();
277
            final JdkLocationPanel jdkLocationPanel = panel.getJdkLocationPanel();
270
            
278
            
271
            if (jdkLocationPanel.getLocations().size() == 0) {
279
            if (jdkLocationPanel.getLocations().isEmpty()) {
272
                final Version minVersion = Version.getVersion(jdkLocationPanel.getProperty(
280
                final Version minVersion = Version.getVersion(jdkLocationPanel.getProperty(
273
                        JdkLocationPanel.MINIMUM_JDK_VERSION_PROPERTY));
281
                        JdkLocationPanel.MINIMUM_JDK_VERSION_PROPERTY));
274
                final Version maxVersion = Version.getVersion(jdkLocationPanel.getProperty(
282
                final Version maxVersion = Version.getVersion(jdkLocationPanel.getProperty(
Lines 281-287 Link Here
281
                        maxVersion.toJdkStyle(),
289
                        maxVersion.toJdkStyle(),
282
                        jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY)));
290
                        jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY)));
283
291
284
                statusLabel.addHyperlinkListener(BrowserUtils.createHyperlinkListener());
292
                statusLabel.addHyperlinkListener(getHyperlinkListener());
285
            } else {
293
            } else {
286
                statusLabel.clearText();
294
                statusLabel.clearText();
287
                statusLabel.setVisible(false);
295
                statusLabel.setVisible(false);
Lines 356-369 Link Here
356
            jdkLocationField = new NbiTextField();
364
            jdkLocationField = new NbiTextField();
357
            jdkLocationField.getDocument().addDocumentListener(
365
            jdkLocationField.getDocument().addDocumentListener(
358
                    new DocumentListener() {
366
                    new DocumentListener() {
367
                        @Override
359
                public void insertUpdate(DocumentEvent e) {
368
                public void insertUpdate(DocumentEvent e) {
360
                    updateErrorMessage();
369
                    updateErrorMessage();
361
                }
370
                }
362
                
371
                
372
                        @Override
363
                public void removeUpdate(DocumentEvent e) {
373
                public void removeUpdate(DocumentEvent e) {
364
                 //   updateErrorMessage();  
374
                 //   updateErrorMessage();  
365
                }
375
                }
366
                
376
                
377
                        @Override
367
                public void changedUpdate(DocumentEvent e) {
378
                public void changedUpdate(DocumentEvent e) {
368
                    updateErrorMessage();
379
                    updateErrorMessage();
369
                }
380
                }
Lines 371-378 Link Here
371
            
382
            
372
            // jdkLocationComboBox //////////////////////////////////////////////////
383
            // jdkLocationComboBox //////////////////////////////////////////////////
373
            final LocationValidator validator = new LocationValidator() {
384
            final LocationValidator validator = new LocationValidator() {
385
                @Override
374
                public void validate(String location) {
386
                public void validate(String location) {
375
                    jdkLocationField.setText(location);
387
                    jdkLocationField.setText(location);
388
                    
389
                    if (!panel.jdkLocationPanel.isJdkVersionRecommended(location)) {
390
                        statusLabel.setText(getJdkWarningMessage());
391
                        if (statusLabel.getHyperlinkListeners().length == 0) {
392
                            statusLabel.addHyperlinkListener(getHyperlinkListener());
393
                        }                        
394
                        statusLabel.setVisible(true);
395
                    } else {
396
                        statusLabel.clearText();
397
                        statusLabel.setVisible(false);
398
                    }
376
                }
399
                }
377
            };
400
            };
378
            
401
            
Lines 380-385 Link Here
380
            jdkLocationComboBox.setEditable(true);
403
            jdkLocationComboBox.setEditable(true);
381
            jdkLocationComboBox.setEditor(new LocationsComboBoxEditor(validator));
404
            jdkLocationComboBox.setEditor(new LocationsComboBoxEditor(validator));
382
            jdkLocationComboBox.addItemListener(new ItemListener() {
405
            jdkLocationComboBox.addItemListener(new ItemListener() {
406
                @Override
383
                public void itemStateChanged(ItemEvent event) {
407
                public void itemStateChanged(ItemEvent event) {
384
                    final ComboBoxModel model = jdkLocationComboBox.getModel();
408
                    final ComboBoxModel model = jdkLocationComboBox.getModel();
385
                    
409
                    
Lines 397-402 Link Here
397
            // browseButton /////////////////////////////////////////////////////////
421
            // browseButton /////////////////////////////////////////////////////////
398
            browseButton = new NbiButton();
422
            browseButton = new NbiButton();
399
            browseButton.addActionListener(new ActionListener() {
423
            browseButton.addActionListener(new ActionListener() {
424
                @Override
400
                public void actionPerformed(ActionEvent event) {
425
                public void actionPerformed(ActionEvent event) {
401
                    browseButtonPressed();
426
                    browseButtonPressed();
402
                }
427
                }
Lines 443-448 Link Here
443
                    0, 0));                           // padx, pady - ???
468
                    0, 0));                           // padx, pady - ???
444
        }
469
        }
445
        
470
        
471
        private Text getJdkWarningMessage() {
472
            if (jdkWarningMessage == null) {
473
                String messageContent = StringUtils.format(
474
                        panel.getProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION), 
475
                        panel.jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY));                
476
                jdkWarningMessage = new Text(messageContent, Text.ContentType.HTML);
477
            } 
478
            
479
            return jdkWarningMessage;
480
        }
481
        
482
        private HyperlinkListener getHyperlinkListener() {
483
            if (hyperlinkListener == null) {
484
                hyperlinkListener = BrowserUtils.createHyperlinkListener();
485
            }
486
            
487
            return hyperlinkListener;
488
        }
489
        
446
        private void browseButtonPressed() {
490
        private void browseButtonPressed() {
447
            fileChooser.setSelectedFile(new File(jdkLocationField.getText().trim()));
491
            fileChooser.setSelectedFile(new File(jdkLocationField.getText().trim()));
448
            
492
            
Lines 461-466 Link Here
461
            "browse.button.text"; // NOI18N
505
            "browse.button.text"; // NOI18N
462
    public static final String WARNING_INSTALL_INTO_USERDIR_PROPERTY =
506
    public static final String WARNING_INSTALL_INTO_USERDIR_PROPERTY =
463
            "install.into.userdir.storage";
507
            "install.into.userdir.storage";
508
    public static final String WARNING_JDK_NOT_RECOMMENDED_VERSION =
509
            "jdk.not.recommended.version";
464
    
510
    
465
    public static final String DEFAULT_TITLE =
511
    public static final String DEFAULT_TITLE =
466
            ResourceUtils.getString(NbBasePanel.class,
512
            ResourceUtils.getString(NbBasePanel.class,
Lines 492-495 Link Here
492
    public static final String DEFAULT_WARNING_INSTALL_INTO_USERDIR =
538
    public static final String DEFAULT_WARNING_INSTALL_INTO_USERDIR =
493
            ResourceUtils.getString(NbBasePanel.class,
539
            ResourceUtils.getString(NbBasePanel.class,
494
            "NBP.warning.install.into.userdir"); // NOI18N
540
            "NBP.warning.install.into.userdir"); // NOI18N
541
    public static final String DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION =
542
            ResourceUtils.getString(NbBasePanel.class,
543
            "NBP.warning.jdk.not.recommended.version"); // NOI18N
495
}
544
}
(-)a/installer/mac/newbuild/Bundle.properties (-1 / +7 lines)
Lines 93-96 Link Here
93
ERR_INVALID_VERSION_MSG=This software can be installed only on Mac OS X v10.4-based system and later.
93
ERR_INVALID_VERSION_MSG=This software can be installed only on Mac OS X v10.4-based system and later.
94
94
95
ERR_NO_JAVA_TITLE=No Java software was found on the system
95
ERR_NO_JAVA_TITLE=No Java software was found on the system
96
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.
96
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.
97
98
WARN_JAVA6_OLDER_JAVA7_TITLE=Unsupported version of Java 7
99
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.
100
101
ERR_OLDER_JAVA7_TITLE=Unsupported update of Java 7
102
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.
(-)a/installer/mac/newbuild/dmg/distribution-cpp.dist (-55 / +71 lines)
Lines 5-20 Link Here
5
    <license file="License.txt"></license>
5
    <license file="License.txt"></license>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
8
    <installation-check script="checkMemsize()"></installation-check>
8
    <installation-check script="checkSystem()"></installation-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
10
    <script>
10
    <script>
11
/* js:pkmk:start */
11
/* js:pkmk:start */
12
function installationCheckRAM() {
12
function checkSystem() {
13
	return  checkMemsize() ;
13
	var java_result = checkJavaVersion();
14
        
15
        if (!java_result) {
16
            return java_result;
17
        }
18
        
19
        var mem_result = checkMemsize();
20
        
21
        return mem_result;
14
}
22
}
15
/* js:pkmk:end */
23
/* js:pkmk:end */
16
24
17
18
/* js:pkmk:start */
25
/* js:pkmk:start */
19
function checkMemsize() {
26
function checkMemsize() {
20
	var result = false;
27
	var result = false;
Lines 30-99 Link Here
30
	return result;
37
	return result;
31
}
38
}
32
/* js:pkmk:end */
39
/* js:pkmk:end */
33
</script>
34
35
<script>
36
/* js:pkmk:start */
37
function volumeCheckTiger() {
38
	return  checkSystemversion() ;
39
}
40
/* js:pkmk:end */
41
42
40
43
/* js:pkmk:start */
41
/* js:pkmk:start */
44
function checkSystemversion() {
42
function checkJavaVersion() {
45
	var result = false;
43
    var result = false;
46
	var version;	
44
    var java7u10_or_newer = false;
47
	try {
45
    var java7_older = false;
48
		version = my.target.systemVersion.ProductVersion;
46
    var java6 = false;
49
		if(version == 'undefined') {
47
    try {
50
			result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
48
        if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
51
		} else {
49
           var res = system.run("/usr/libexec/java_home", "--version", "1.7.0_10+", "--failfast");                       
52
			result = ( -1 != system.compareVersions(version, '10.5'));
50
           java7u10_or_newer = (0 == res);
53
		}
51
           if(!java7u10_or_newer) {
54
	
52
               var res = system.run("/usr/libexec/java_home", "--version", "1.6", "--failfast");                       
55
	} catch (e) {}
53
               java6 = (0 == res);
56
	
54
           }
57
	if(!result) {
55
           if(!java7u10_or_newer) {
58
		my.result.type = 'Fatal';
56
               var res = system.run("/usr/libexec/java_home", "--version", "1.7+", "--failfast");                       
59
		my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
57
               java7_older = (0 == res);
60
		my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
58
           }
61
	} else {
59
        }
62
		try {
60
    } catch (e) {}
63
                    if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
64
                       var res = system.run("/usr/libexec/java_home", "--version", "1.6+", "--failfast");                       
65
                       result = (0 == res);
66
                    }
67
		} catch (e) {}
68
61
69
		if(!result) {
62
    if(java7u10_or_newer) {
70
			my.result.type = 'Fatal';
63
        result = true;
71
			my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
64
    } else {
72
			my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
65
        if(java7_older) {
73
		}
66
            if (java6) {
67
                my.result.type = 'Warn';
68
                my.result.title = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_TITLE');
69
                my.result.message = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_MSG');
70
            } else {
71
                my.result.type = 'Fatal';
72
                my.result.title = system.localizedStringWithFormat('ERR_OLDER_JAVA7_TITLE');
73
                my.result.message = system.localizedStringWithFormat('ERR_OLDER_JAVA7_MSG');
74
            }
75
        } else {
76
            if (java6) {
77
                result = true;
78
            } else {
79
                my.result.type = 'Fatal';
80
                my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
81
                my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
82
            }
74
        }
83
        }
84
    }
75
85
76
	return result;
86
    return result;
77
}
87
}
78
/* js:pkmk:end */
88
/* js:pkmk:end */
79
</script>
89
</script>
80
90
81
<script>
91
<script>
82
/* js:pkmk:start */
92
/* js:pkmk:start */
83
function choiceIsADowngrade() {
93
function checkSystemversion() {
84
	return  checkChoiceUpgradeAction() ;
94
    var result = false;
85
}
95
    var version;	
86
/* js:pkmk:end */
96
    try {
97
            version = my.target.systemVersion.ProductVersion;
98
            if(version == 'undefined') {
99
                    result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
100
            } else {
101
                    result = ( -1 != system.compareVersions(version, '10.5'));
102
            }
87
103
104
    } catch (e) {}
88
105
89
/* js:pkmk:start */
106
    if(!result) {
90
function checkChoiceUpgradeAction() {
107
            my.result.type = 'Fatal';
91
	var result = false;
108
            my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
92
	try {
109
            my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
93
		result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed';
110
    }
94
	} catch (e) {}
111
95
	
112
    return result;
96
	return result;
97
}
113
}
98
/* js:pkmk:end */
114
/* js:pkmk:end */
99
</script>
115
</script>
(-)a/installer/mac/newbuild/dmg/distribution-javaee.dist (-55 / +71 lines)
Lines 5-20 Link Here
5
    <license file="License.txt"></license>
5
    <license file="License.txt"></license>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
7
    <options allow-external-scripts="yes" customize="allow" rootVolumeOnly="false" hostArchitectures="i386"></options>
7
    <options allow-external-scripts="yes" customize="allow" rootVolumeOnly="false" hostArchitectures="i386"></options>
8
    <installation-check script="checkMemsize()"></installation-check>
8
    <installation-check script="checkSystem()"></installation-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
10
    <script>
10
    <script>
11
/* js:pkmk:start */
11
/* js:pkmk:start */
12
function installationCheckRAM() {
12
function checkSystem() {
13
	return  checkMemsize() ;
13
	var java_result = checkJavaVersion();
14
        
15
        if (!java_result) {
16
            return java_result;
17
        }
18
        
19
        var mem_result = checkMemsize();
20
        
21
        return mem_result;
14
}
22
}
15
/* js:pkmk:end */
23
/* js:pkmk:end */
16
24
17
18
/* js:pkmk:start */
25
/* js:pkmk:start */
19
function checkMemsize() {
26
function checkMemsize() {
20
	var result = false;
27
	var result = false;
Lines 30-99 Link Here
30
	return result;
37
	return result;
31
}
38
}
32
/* js:pkmk:end */
39
/* js:pkmk:end */
33
</script>
34
35
<script>
36
/* js:pkmk:start */
37
function volumeCheckTiger() {
38
	return  checkSystemversion() ;
39
}
40
/* js:pkmk:end */
41
42
40
43
/* js:pkmk:start */
41
/* js:pkmk:start */
44
function checkSystemversion() {
42
function checkJavaVersion() {
45
	var result = false;
43
    var result = false;
46
	var version;	
44
    var java7u10_or_newer = false;
47
	try {
45
    var java7_older = false;
48
		version = my.target.systemVersion.ProductVersion;
46
    var java6 = false;
49
		if(version == 'undefined') {
47
    try {
50
			result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
48
        if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
51
		} else {
49
           var res = system.run("/usr/libexec/java_home", "--version", "1.7.0_10+", "--failfast");                       
52
			result = ( -1 != system.compareVersions(version, '10.5'));
50
           java7u10_or_newer = (0 == res);
53
		}
51
           if(!java7u10_or_newer) {
54
	
52
               var res = system.run("/usr/libexec/java_home", "--version", "1.6", "--failfast");                       
55
	} catch (e) {}
53
               java6 = (0 == res);
56
	
54
           }
57
	if(!result) {
55
           if(!java7u10_or_newer) {
58
		my.result.type = 'Fatal';
56
               var res = system.run("/usr/libexec/java_home", "--version", "1.7+", "--failfast");                       
59
		my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
57
               java7_older = (0 == res);
60
		my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
58
           }
61
	} else {
59
        }
62
		try {
60
    } catch (e) {}
63
                    if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
64
                       var res = system.run("/usr/libexec/java_home", "--version", "1.6+", "--failfast");                       
65
                       result = (0 == res);
66
                    }
67
		} catch (e) {}
68
61
69
		if(!result) {
62
    if(java7u10_or_newer) {
70
			my.result.type = 'Fatal';
63
        result = true;
71
			my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
64
    } else {
72
			my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
65
        if(java7_older) {
73
		}
66
            if (java6) {
67
                my.result.type = 'Warn';
68
                my.result.title = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_TITLE');
69
                my.result.message = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_MSG');
70
            } else {
71
                my.result.type = 'Fatal';
72
                my.result.title = system.localizedStringWithFormat('ERR_OLDER_JAVA7_TITLE');
73
                my.result.message = system.localizedStringWithFormat('ERR_OLDER_JAVA7_MSG');
74
            }
75
        } else {
76
            if (java6) {
77
                result = true;
78
            } else {
79
                my.result.type = 'Fatal';
80
                my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
81
                my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
82
            }
74
        }
83
        }
84
    }
75
85
76
	return result;
86
    return result;
77
}
87
}
78
/* js:pkmk:end */
88
/* js:pkmk:end */
79
</script>
89
</script>
80
90
81
<script>
91
<script>
82
/* js:pkmk:start */
92
/* js:pkmk:start */
83
function choiceIsADowngrade() {
93
function checkSystemversion() {
84
	return  checkChoiceUpgradeAction() ;
94
    var result = false;
85
}
95
    var version;	
86
/* js:pkmk:end */
96
    try {
97
            version = my.target.systemVersion.ProductVersion;
98
            if(version == 'undefined') {
99
                    result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
100
            } else {
101
                    result = ( -1 != system.compareVersions(version, '10.5'));
102
            }
87
103
104
    } catch (e) {}
88
105
89
/* js:pkmk:start */
106
    if(!result) {
90
function checkChoiceUpgradeAction() {
107
            my.result.type = 'Fatal';
91
	var result = false;
108
            my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
92
	try {
109
            my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
93
		result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed';
110
    }
94
	} catch (e) {}
111
95
	
112
    return result;
96
	return result;
97
}
113
}
98
/* js:pkmk:end */
114
/* js:pkmk:end */
99
</script>
115
</script>
(-)a/installer/mac/newbuild/dmg/distribution-javase.dist (-55 / +71 lines)
Lines 5-20 Link Here
5
    <license file="License.txt"></license>
5
    <license file="License.txt"></license>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
8
    <installation-check script="checkMemsize()"></installation-check>
8
    <installation-check script="checkSystem()"></installation-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
10
    <script>
10
    <script>
11
/* js:pkmk:start */
11
/* js:pkmk:start */
12
function installationCheckRAM() {
12
function checkSystem() {
13
	return  checkMemsize() ;
13
	var java_result = checkJavaVersion();
14
        
15
        if (!java_result) {
16
            return java_result;
17
        }
18
        
19
        var mem_result = checkMemsize();
20
        
21
        return mem_result;
14
}
22
}
15
/* js:pkmk:end */
23
/* js:pkmk:end */
16
24
17
18
/* js:pkmk:start */
25
/* js:pkmk:start */
19
function checkMemsize() {
26
function checkMemsize() {
20
	var result = false;
27
	var result = false;
Lines 30-99 Link Here
30
	return result;
37
	return result;
31
}
38
}
32
/* js:pkmk:end */
39
/* js:pkmk:end */
33
</script>
34
35
<script>
36
/* js:pkmk:start */
37
function volumeCheckTiger() {
38
	return  checkSystemversion() ;
39
}
40
/* js:pkmk:end */
41
42
40
43
/* js:pkmk:start */
41
/* js:pkmk:start */
44
function checkSystemversion() {
42
function checkJavaVersion() {
45
	var result = false;
43
    var result = false;
46
	var version;	
44
    var java7u10_or_newer = false;
47
	try {
45
    var java7_older = false;
48
		version = my.target.systemVersion.ProductVersion;
46
    var java6 = false;
49
		if(version == 'undefined') {
47
    try {
50
			result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
48
        if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
51
		} else {
49
           var res = system.run("/usr/libexec/java_home", "--version", "1.7.0_10+", "--failfast");                       
52
			result = ( -1 != system.compareVersions(version, '10.5'));
50
           java7u10_or_newer = (0 == res);
53
		}
51
           if(!java7u10_or_newer) {
54
	
52
               var res = system.run("/usr/libexec/java_home", "--version", "1.6", "--failfast");                       
55
	} catch (e) {}
53
               java6 = (0 == res);
56
	
54
           }
57
	if(!result) {
55
           if(!java7u10_or_newer) {
58
		my.result.type = 'Fatal';
56
               var res = system.run("/usr/libexec/java_home", "--version", "1.7+", "--failfast");                       
59
		my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
57
               java7_older = (0 == res);
60
		my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
58
           }
61
	} else {
59
        }
62
		try {
60
    } catch (e) {}
63
                    if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
64
                       var res = system.run("/usr/libexec/java_home", "--version", "1.6+", "--failfast");                       
65
                       result = (0 == res);
66
                    }
67
		} catch (e) {}
68
61
69
		if(!result) {
62
    if(java7u10_or_newer) {
70
			my.result.type = 'Fatal';
63
        result = true;
71
			my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
64
    } else {
72
			my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
65
        if(java7_older) {
73
		}
66
            if (java6) {
67
                my.result.type = 'Warn';
68
                my.result.title = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_TITLE');
69
                my.result.message = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_MSG');
70
            } else {
71
                my.result.type = 'Fatal';
72
                my.result.title = system.localizedStringWithFormat('ERR_OLDER_JAVA7_TITLE');
73
                my.result.message = system.localizedStringWithFormat('ERR_OLDER_JAVA7_MSG');
74
            }
75
        } else {
76
            if (java6) {
77
                result = true;
78
            } else {
79
                my.result.type = 'Fatal';
80
                my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
81
                my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
82
            }
74
        }
83
        }
84
    }
75
85
76
	return result;
86
    return result;
77
}
87
}
78
/* js:pkmk:end */
88
/* js:pkmk:end */
79
</script>
89
</script>
80
90
81
<script>
91
<script>
82
/* js:pkmk:start */
92
/* js:pkmk:start */
83
function choiceIsADowngrade() {
93
function checkSystemversion() {
84
	return  checkChoiceUpgradeAction() ;
94
    var result = false;
85
}
95
    var version;	
86
/* js:pkmk:end */
96
    try {
97
            version = my.target.systemVersion.ProductVersion;
98
            if(version == 'undefined') {
99
                    result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
100
            } else {
101
                    result = ( -1 != system.compareVersions(version, '10.5'));
102
            }
87
103
104
    } catch (e) {}
88
105
89
/* js:pkmk:start */
106
    if(!result) {
90
function checkChoiceUpgradeAction() {
107
            my.result.type = 'Fatal';
91
	var result = false;
108
            my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
92
	try {
109
            my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
93
		result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed';
110
    }
94
	} catch (e) {}
111
95
	
112
    return result;
96
	return result;
97
}
113
}
98
/* js:pkmk:end */
114
/* js:pkmk:end */
99
</script>
115
</script>
(-)a/installer/mac/newbuild/dmg/distribution-php.dist (-55 / +71 lines)
Lines 5-20 Link Here
5
    <license file="License.txt"></license>
5
    <license file="License.txt"></license>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
7
    <options allow-external-scripts="yes" customize="never" rootVolumeOnly="false" hostArchitectures="i386"></options>
8
    <installation-check script="checkMemsize()"></installation-check>
8
    <installation-check script="checkSystem()"></installation-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
10
    <script>
10
    <script>
11
/* js:pkmk:start */
11
/* js:pkmk:start */
12
function installationCheckRAM() {
12
function checkSystem() {
13
	return  checkMemsize() ;
13
	var java_result = checkJavaVersion();
14
        
15
        if (!java_result) {
16
            return java_result;
17
        }
18
        
19
        var mem_result = checkMemsize();
20
        
21
        return mem_result;
14
}
22
}
15
/* js:pkmk:end */
23
/* js:pkmk:end */
16
24
17
18
/* js:pkmk:start */
25
/* js:pkmk:start */
19
function checkMemsize() {
26
function checkMemsize() {
20
	var result = false;
27
	var result = false;
Lines 30-99 Link Here
30
	return result;
37
	return result;
31
}
38
}
32
/* js:pkmk:end */
39
/* js:pkmk:end */
33
</script>
34
35
<script>
36
/* js:pkmk:start */
37
function volumeCheckTiger() {
38
	return  checkSystemversion() ;
39
}
40
/* js:pkmk:end */
41
42
40
43
/* js:pkmk:start */
41
/* js:pkmk:start */
44
function checkSystemversion() {
42
function checkJavaVersion() {
45
	var result = false;
43
    var result = false;
46
	var version;	
44
    var java7u10_or_newer = false;
47
	try {
45
    var java7_older = false;
48
		version = my.target.systemVersion.ProductVersion;
46
    var java6 = false;
49
		if(version == 'undefined') {
47
    try {
50
			result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
48
        if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
51
		} else {
49
           var res = system.run("/usr/libexec/java_home", "--version", "1.7.0_10+", "--failfast");                       
52
			result = ( -1 != system.compareVersions(version, '10.5'));
50
           java7u10_or_newer = (0 == res);
53
		}
51
           if(!java7u10_or_newer) {
54
	
52
               var res = system.run("/usr/libexec/java_home", "--version", "1.6", "--failfast");                       
55
	} catch (e) {}
53
               java6 = (0 == res);
56
	
54
           }
57
	if(!result) {
55
           if(!java7u10_or_newer) {
58
		my.result.type = 'Fatal';
56
               var res = system.run("/usr/libexec/java_home", "--version", "1.7+", "--failfast");                       
59
		my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
57
               java7_older = (0 == res);
60
		my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
58
           }
61
	} else {
59
        }
62
		try {
60
    } catch (e) {}
63
                    if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
64
                       var res = system.run("/usr/libexec/java_home", "--version", "1.6+", "--failfast");                       
65
                       result = (0 == res);
66
                    }
67
		} catch (e) {}
68
61
69
		if(!result) {
62
    if(java7u10_or_newer) {
70
			my.result.type = 'Fatal';
63
        result = true;
71
			my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
64
    } else {
72
			my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
65
        if(java7_older) {
73
		}
66
            if (java6) {
67
                my.result.type = 'Warn';
68
                my.result.title = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_TITLE');
69
                my.result.message = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_MSG');
70
            } else {
71
                my.result.type = 'Fatal';
72
                my.result.title = system.localizedStringWithFormat('ERR_OLDER_JAVA7_TITLE');
73
                my.result.message = system.localizedStringWithFormat('ERR_OLDER_JAVA7_MSG');
74
            }
75
        } else {
76
            if (java6) {
77
                result = true;
78
            } else {
79
                my.result.type = 'Fatal';
80
                my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
81
                my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
82
            }
74
        }
83
        }
84
    }
75
85
76
	return result;
86
    return result;
77
}
87
}
78
/* js:pkmk:end */
88
/* js:pkmk:end */
79
</script>
89
</script>
80
90
81
<script>
91
<script>
82
/* js:pkmk:start */
92
/* js:pkmk:start */
83
function choiceIsADowngrade() {
93
function checkSystemversion() {
84
	return  checkChoiceUpgradeAction() ;
94
    var result = false;
85
}
95
    var version;	
86
/* js:pkmk:end */
96
    try {
97
            version = my.target.systemVersion.ProductVersion;
98
            if(version == 'undefined') {
99
                    result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
100
            } else {
101
                    result = ( -1 != system.compareVersions(version, '10.5'));
102
            }
87
103
104
    } catch (e) {}
88
105
89
/* js:pkmk:start */
106
    if(!result) {
90
function checkChoiceUpgradeAction() {
107
            my.result.type = 'Fatal';
91
	var result = false;
108
            my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
92
	try {
109
            my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
93
		result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed';
110
    }
94
	} catch (e) {}
111
95
	
112
    return result;
96
	return result;
97
}
113
}
98
/* js:pkmk:end */
114
/* js:pkmk:end */
99
</script>
115
</script>
(-)a/installer/mac/newbuild/dmg/distribution.dist (-58 / +73 lines)
Lines 5-20 Link Here
5
    <license file="License.txt"></license>
5
    <license file="License.txt"></license>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
6
    <background file="background.tif" scaling="none" alignment="topleft"></background>
7
    <options allow-external-scripts="yes" customize="allow" rootVolumeOnly="false" hostArchitectures="i386"></options>
7
    <options allow-external-scripts="yes" customize="allow" rootVolumeOnly="false" hostArchitectures="i386"></options>
8
    <installation-check script="checkMemsize()"></installation-check>
8
    <installation-check script="checkSystem()"></installation-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
9
    <volume-check script="checkSystemversion()"></volume-check>
10
    <script>
10
    <script>
11
/* js:pkmk:start */
11
/* js:pkmk:start */
12
function installationCheckRAM() {
12
function checkSystem() {
13
	return  checkMemsize() ;
13
	var java_result = checkJavaVersion();
14
        
15
        if (!java_result) {
16
            return java_result;
17
        }
18
        
19
        var mem_result = checkMemsize();
20
        
21
        return mem_result;
14
}
22
}
15
/* js:pkmk:end */
23
/* js:pkmk:end */
16
24
17
18
/* js:pkmk:start */
25
/* js:pkmk:start */
19
function checkMemsize() {
26
function checkMemsize() {
20
	var result = false;
27
	var result = false;
Lines 30-105 Link Here
30
	return result;
37
	return result;
31
}
38
}
32
/* js:pkmk:end */
39
/* js:pkmk:end */
33
</script>
34
35
<script>
36
/* js:pkmk:start */
37
function volumeCheckTiger() {
38
	return  checkSystemversion() ;
39
}
40
/* js:pkmk:end */
41
42
40
43
/* js:pkmk:start */
41
/* js:pkmk:start */
44
function checkSystemversion() {
42
function checkJavaVersion() {
45
	var result = false;
43
    var result = false;
46
	var version;	
44
    var java7u10_or_newer = false;
47
	try {
45
    var java7_older = false;
48
		version = my.target.systemVersion.ProductVersion;
46
    var java6 = false;
49
		if(version == 'undefined') {
47
    try {
50
			result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
48
        if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
51
		} else {
49
           var res = system.run("/usr/libexec/java_home", "--version", "1.7.0_10+", "--failfast");                       
52
			result = ( -1 != system.compareVersions(version, '10.5'));
50
           java7u10_or_newer = (0 == res);
53
		}
51
           if(!java7u10_or_newer) {
54
	
52
               var res = system.run("/usr/libexec/java_home", "--version", "1.6", "--failfast");                       
55
	} catch (e) {}
53
               java6 = (0 == res);
56
	
54
           }
57
	if(!result) {
55
           if(!java7u10_or_newer) {
58
		my.result.type = 'Fatal';
56
               var res = system.run("/usr/libexec/java_home", "--version", "1.7+", "--failfast");                       
59
		my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
57
               java7_older = (0 == res);
60
		my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
58
           }
61
	} else {				
62
		try {
63
                    if(system.files.fileExistsAtPath('/usr/libexec/java_home')) {
64
                       var res = system.run("/usr/libexec/java_home", "--version", "1.6+", "--failfast");                       
65
                       result = (0 == res);
66
                    }
67
		} catch (e) {}
68
		
69
		if(!result) {
70
			my.result.type = 'Fatal';
71
			my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
72
			my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
73
		}
74
        }
59
        }
60
    } catch (e) {}
75
61
76
	return result;
62
    if(java7u10_or_newer) {
63
        result = true;
64
    } else {
65
        if(java7_older) {
66
            if (java6) {
67
                my.result.type = 'Warn';
68
                my.result.title = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_TITLE');
69
                my.result.message = system.localizedStringWithFormat('WARN_JAVA6_OLDER_JAVA7_MSG');
70
            } else {
71
                my.result.type = 'Fatal';
72
                my.result.title = system.localizedStringWithFormat('ERR_OLDER_JAVA7_TITLE');
73
                my.result.message = system.localizedStringWithFormat('ERR_OLDER_JAVA7_MSG');
74
            }
75
        } else {
76
            if (java6) {
77
                result = true;
78
            } else {
79
                my.result.type = 'Fatal';
80
                my.result.title = system.localizedStringWithFormat('ERR_NO_JAVA_TITLE');
81
                my.result.message = system.localizedStringWithFormat('ERR_NO_JAVA_MSG');
82
            }
83
        }
84
    }
85
86
    return result;
77
}
87
}
78
/* js:pkmk:end */
88
/* js:pkmk:end */
79
</script>
89
</script>
80
90
81
<script>
91
<script>
82
/* js:pkmk:start */
92
/* js:pkmk:start */
83
function choiceIsADowngrade() {
93
function checkSystemversion() {
84
	return  checkChoiceUpgradeAction() ;
94
    var result = false;
85
}
95
    var version;	
86
/* js:pkmk:end */
96
    try {
97
            version = my.target.systemVersion.ProductVersion;
98
            if(version == 'undefined') {
99
                    result = ( -1 != system.compareVersions(system.version.ProductVersion, '10.5'));
100
            } else {
101
                    result = ( -1 != system.compareVersions(version, '10.5'));
102
            }
87
103
104
    } catch (e) {}
88
105
89
/* js:pkmk:start */
106
    if(!result) {
90
function checkChoiceUpgradeAction() {
107
            my.result.type = 'Fatal';
91
	var result = false;
108
            my.result.title = system.localizedStringWithFormat('ERR_INVALID_VERSION_TITLE');
92
	try {
109
            my.result.message = system.localizedStringWithFormat('ERR_INVALID_VERSION_MSG');
93
		result = my.choice.packageUpgradeAction == 'downgrade' || my.choice.packageUpgradeAction == 'mixed';
110
    }
94
	} catch (e) {}
111
95
	
112
    return result;
96
	return result;
97
}
113
}
98
/* js:pkmk:end */
114
/* js:pkmk:end */
99
</script>
115
</script>
100
116
101
117
<choices-outline>
102
    <choices-outline>
103
        <line choice="netbeans">
118
        <line choice="netbeans">
104
            <line choice="baseide"></line>
119
            <line choice="baseide"></line>
105
            <line choice="javase"></line>
120
            <line choice="javase"></line>
(-)a/nbi/engine/src/org/netbeans/installer/utils/applications/JavaUtils.java (-10 / +21 lines)
Lines 45-65 Link Here
45
import java.util.Map;
45
import java.util.Map;
46
import java.util.regex.Matcher;
46
import java.util.regex.Matcher;
47
import java.util.regex.Pattern;
47
import java.util.regex.Pattern;
48
import org.netbeans.installer.utils.ErrorManager;
49
import org.netbeans.installer.utils.FileProxy;
48
import org.netbeans.installer.utils.LogManager;
50
import org.netbeans.installer.utils.LogManager;
49
import org.netbeans.installer.utils.ResourceUtils;
51
import org.netbeans.installer.utils.ResourceUtils;
50
import org.netbeans.installer.utils.helper.ExecutionResults;
51
import org.netbeans.installer.utils.FileProxy;
52
import org.netbeans.installer.utils.ErrorManager;
53
import org.netbeans.installer.utils.StringUtils;
52
import org.netbeans.installer.utils.StringUtils;
54
import org.netbeans.installer.utils.SystemUtils;
53
import org.netbeans.installer.utils.SystemUtils;
55
import org.netbeans.installer.utils.exceptions.DownloadException;
54
import org.netbeans.installer.utils.exceptions.DownloadException;
56
import org.netbeans.installer.utils.exceptions.NativeException;
55
import org.netbeans.installer.utils.exceptions.NativeException;
56
import org.netbeans.installer.utils.helper.ExecutionResults;
57
import org.netbeans.installer.utils.helper.Version;
57
import org.netbeans.installer.utils.helper.Version;
58
import org.netbeans.installer.utils.system.WindowsNativeUtils;
58
import org.netbeans.installer.utils.system.WindowsNativeUtils;
59
import org.netbeans.installer.utils.system.windows.WindowsRegistry;
60
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
59
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
61
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
60
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
61
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.SEPARATOR;
62
import org.netbeans.installer.utils.system.windows.WindowsRegistry;
63
62
64
/**
63
/**
65
 *
64
 *
Lines 131-146 Link Here
131
        
130
        
132
        return true;
131
        return true;
133
    }
132
    }
133
    
134
    public static boolean isRecommended(Version version) {
135
        /*to and from versions - not recommended - all JDK 7 versions older than 7u10 */        
136
        return version.olderThan(criticalLowVersion) || version.newerThan(criticalHighVersion);
137
    }
138
    
134
    public static void addJavaInfo(final File location, final JavaInfo info) {
139
    public static void addJavaInfo(final File location, final JavaInfo info) {
135
        if(knownJdks.get(location)==null) {
140
        if(knownJdks.get(location)==null) {
136
            knownJdks.put(location, info);
141
            knownJdks.put(location, info);
137
        }
142
        }
138
    }
143
    }
144
    
139
    public static void removeJavaInfo(final File location) {
145
    public static void removeJavaInfo(final File location) {
140
        if(knownJdks.get(location)!=null) {
146
        if(knownJdks.get(location)!=null) {
141
            knownJdks.remove(location);
147
            knownJdks.remove(location);
142
        }
148
        }
143
    }
149
    }
150
    
144
    public static Version getVersion(File javaHome) {
151
    public static Version getVersion(File javaHome) {
145
        final JavaInfo info = getInfo(javaHome);
152
        final JavaInfo info = getInfo(javaHome);
146
        
153
        
Lines 270-276 Link Here
270
                LogManager.log("... checking if JDK " + version + " is already installed");
277
                LogManager.log("... checking if JDK " + version + " is already installed");
271
                WindowsRegistry winreg = ((WindowsNativeUtils) SystemUtils.getNativeUtils()).getWindowsRegistry();
278
                WindowsRegistry winreg = ((WindowsNativeUtils) SystemUtils.getNativeUtils()).getWindowsRegistry();
272
                if(winreg.keyExists(HKLM, javaKey, version)) {
279
                if(winreg.keyExists(HKLM, javaKey, version)) {
273
                    final String versKey = javaKey + winreg.SEPARATOR + version;
280
                    final String versKey = javaKey + WindowsRegistry.SEPARATOR + version;
274
                    if(winreg.valueExists(HKLM, versKey, JAVAHOME_VALUE)) {
281
                    if(winreg.valueExists(HKLM, versKey, JAVAHOME_VALUE)) {
275
                        final String javaHome = winreg.getStringValue(HKLM, versKey,JAVAHOME_VALUE);
282
                        final String javaHome = winreg.getStringValue(HKLM, versKey,JAVAHOME_VALUE);
276
                        if(JavaUtils.getInfo(new File(javaHome))!=null) {
283
                        if(JavaUtils.getInfo(new File(javaHome))!=null) {
Lines 290-295 Link Here
290
        }
297
        }
291
        return result;
298
        return result;
292
    }
299
    }
300
    
293
    // private //////////////////////////////////////////////////////////////////////
301
    // private //////////////////////////////////////////////////////////////////////
294
    private static int getJDKRegistrySection(WindowsRegistry registry) throws NativeException {
302
    private static int getJDKRegistrySection(WindowsRegistry registry) throws NativeException {
295
        return (registry.canModifyKey(HKLM,JDK_KEY) ? HKLM : HKCU);
303
        return (registry.canModifyKey(HKLM,JDK_KEY) ? HKLM : HKCU);
Lines 370-378 Link Here
370
            final String[] lines = StringUtils.splitByLines(string);
378
            final String[] lines = StringUtils.splitByLines(string);
371
            
379
            
372
            Version version = null;
380
            Version version = null;
373
            String vendor = null;
381
            String vendor;
374
            String osName = null;
382
            String osName;
375
            String osArch = null;
383
            String osArch;
376
            
384
            
377
            boolean nonFinal = false;
385
            boolean nonFinal = false;
378
            
386
            
Lines 506-511 Link Here
506
    
514
    
507
    /////////////////////////////////////////////////////////////////////////////////
515
    /////////////////////////////////////////////////////////////////////////////////
508
    // Constants
516
    // Constants
517
    public static Version criticalLowVersion = Version.getVersion("1.7.0_00");
518
    public static Version criticalHighVersion = Version.getVersion("1.7.0_09");            
519
    
509
    public static final String JDK_KEY =
520
    public static final String JDK_KEY =
510
            "SOFTWARE\\JavaSoft\\Java Development Kit"; // NOI18N
521
            "SOFTWARE\\JavaSoft\\Java Development Kit"; // NOI18N
511
    public static final String JRE_KEY =
522
    public static final String JRE_KEY =
(-)a/nbi/engine/src/org/netbeans/installer/wizard/components/actions/SearchForJavaAction.java (-22 / +33 lines)
Lines 48-70 Link Here
48
import java.util.List;
48
import java.util.List;
49
import org.netbeans.installer.product.Registry;
49
import org.netbeans.installer.product.Registry;
50
import org.netbeans.installer.product.components.Product;
50
import org.netbeans.installer.product.components.Product;
51
import org.netbeans.installer.utils.helper.ErrorLevel;
51
import org.netbeans.installer.utils.*;
52
import org.netbeans.installer.utils.ErrorManager;
53
import org.netbeans.installer.utils.FileUtils;
54
import org.netbeans.installer.utils.LogManager;
55
import org.netbeans.installer.utils.ResourceUtils;
56
import org.netbeans.installer.utils.StringUtils;
57
import org.netbeans.installer.utils.SystemUtils;
58
import org.netbeans.installer.utils.applications.JavaUtils;
52
import org.netbeans.installer.utils.applications.JavaUtils;
59
import org.netbeans.installer.utils.applications.JavaUtils.JavaInfo;
53
import org.netbeans.installer.utils.applications.JavaUtils.JavaInfo;
60
import org.netbeans.installer.utils.exceptions.NativeException;
54
import org.netbeans.installer.utils.exceptions.NativeException;
55
import org.netbeans.installer.utils.helper.ErrorLevel;
61
import org.netbeans.installer.utils.helper.Status;
56
import org.netbeans.installer.utils.helper.Status;
62
import org.netbeans.installer.utils.helper.Version;
57
import org.netbeans.installer.utils.helper.Version;
63
import org.netbeans.installer.utils.progress.Progress;
58
import org.netbeans.installer.utils.progress.Progress;
64
import org.netbeans.installer.utils.system.WindowsNativeUtils;
59
import org.netbeans.installer.utils.system.WindowsNativeUtils;
65
import org.netbeans.installer.utils.system.windows.WindowsRegistry;
60
import org.netbeans.installer.utils.system.windows.WindowsRegistry;
61
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
66
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
62
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKLM;
67
import static org.netbeans.installer.utils.system.windows.WindowsRegistry.HKCU;
68
import org.netbeans.installer.wizard.components.WizardAction;
63
import org.netbeans.installer.wizard.components.WizardAction;
69
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
64
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel;
70
65
Lines 83-91 Link Here
83
        setProperty(DESCRIPTION_PROPERTY, DEFAULT_DESCRIPTION);
78
        setProperty(DESCRIPTION_PROPERTY, DEFAULT_DESCRIPTION);
84
    }
79
    }
85
    
80
    
81
    @Override
86
    public void execute() {        
82
    public void execute() {        
87
        execute(new Progress());
83
        execute(new Progress());
88
    }
84
    }
85
    
89
    public void execute(Progress progress) {
86
    public void execute(Progress progress) {
90
        LogManager.logEntry("search for all java locations");
87
        LogManager.logEntry("search for all java locations");
91
        getWizardUi().setProgress(progress);
88
        getWizardUi().setProgress(progress);
Lines 113-122 Link Here
113
        SystemUtils.sleep(200);
110
        SystemUtils.sleep(200);
114
        LogManager.logExit("... end of search for all java locations");
111
        LogManager.logExit("... end of search for all java locations");
115
    }
112
    }
113
    
116
    @Override
114
    @Override
117
    public boolean canExecuteForward() {
115
    public boolean canExecuteForward() {
118
        return javaLocations.size() == 0;
116
        return javaLocations.isEmpty();
119
    }
117
    }
118
    
120
     // private //////////////////////////////////////////////////////////////////////
119
     // private //////////////////////////////////////////////////////////////////////
121
    private static String getLabel(File javaHome) {
120
    private static String getLabel(File javaHome) {
122
        JavaInfo javaInfo = JavaUtils.getInfo(javaHome);
121
        JavaInfo javaInfo = JavaUtils.getInfo(javaHome);
Lines 203-212 Link Here
203
        }
202
        }
204
        
203
        
205
    }
204
    }
205
    
206
    public static void sortJavaLocations(){
206
    public static void sortJavaLocations(){
207
        // sort the found java installations:
207
        // sort the found java installations:
208
        //   1) by final/non-final
208
        //   1) by final/non-final
209
        //   2) by version descending
209
        //   2) by version descending (6 has priority over 7u9 and older)
210
        //   3) by path acending
210
        //   3) by path acending
211
        //   4) by vendor descending (so Sun comes first, hehe)
211
        //   4) by vendor descending (so Sun comes first, hehe)
212
        for (int i = 0; i < javaLocations.size(); i++) {
212
        for (int i = 0; i < javaLocations.size(); i++) {
Lines 219-245 Link Here
219
                
219
                
220
                JavaInfo info1 = JavaUtils.getInfo(javaLocations.get(j));
220
                JavaInfo info1 = JavaUtils.getInfo(javaLocations.get(j));
221
                JavaInfo info2 = JavaUtils.getInfo(javaLocations.get(j - 1));
221
                JavaInfo info2 = JavaUtils.getInfo(javaLocations.get(j - 1));
222
                
222
                                               
223
                if (info1.isNonFinal() == info2.isNonFinal()) {
223
                if (info1.isNonFinal() == info2.isNonFinal()) {
224
                    if (info1.getVersion().equals(info2.getVersion())) {
224
                    if (JavaUtils.isRecommended(info1.getVersion()) == JavaUtils.isRecommended(info2.getVersion())) {                        
225
                        if (file1.getPath().compareTo(file2.getPath()) == 0) {
225
                        if (info1.getVersion().equals(info2.getVersion())) {
226
                            if (info1.getVendor().compareTo(info2.getVendor()) == 0) {
226
                            // better than compare directly archs is to compare if archs are both 64bit
227
                                continue;
227
                            if (info1.getArch().endsWith("64") == info2.getArch().endsWith("64")) {                                                            
228
                            } else if (info1.getVendor().compareTo(info2.getVendor()) < 0) {
228
                                if (file1.getPath().compareTo(file2.getPath()) == 0) {
229
                                    if (info1.getVendor().compareTo(info2.getVendor()) == 0) {
230
                                        continue;
231
                                    } else if (info1.getVendor().compareTo(info2.getVendor()) < 0) {
232
                                        switchNeighbours(j, file2, file1, label2, label1);
233
                                    }
234
                                } else if (file1.getPath().length() < file2.getPath().length()) {
235
                                    switchNeighbours(j, file2, file1, label2, label1);
236
                                }
237
                            } else if (info1.getArch().endsWith("64") && !info2.getArch().endsWith("64")) {
229
                                switchNeighbours(j, file2, file1, label2, label1);
238
                                switchNeighbours(j, file2, file1, label2, label1);
230
                            }
239
                            }
231
                        } else if (file1.getPath().length() < file2.getPath().length()) {
240
                        } else if (info1.getVersion().newerThan(info2.getVersion())) {
232
                            switchNeighbours(j, file2, file1, label2, label1);
241
                            switchNeighbours(j, file2, file1, label2, label1);
233
                        }
242
                        }
234
                    } else if (info1.getVersion().newerThan(info2.getVersion())) {
243
                    } else if (JavaUtils.isRecommended(info1.getVersion()) && !JavaUtils.isRecommended(info2.getVersion())) {
235
                        switchNeighbours(j, file2, file1, label2, label1);
244
                        switchNeighbours(j, file2, file1, label2, label1);
236
                    }
245
                    }                    
237
                } else if (!info1.isNonFinal() && info2.isNonFinal()) {
246
                } else if (!info1.isNonFinal() && info2.isNonFinal()) {
238
                    switchNeighbours(j, file2, file1, label2, label1);
247
                    switchNeighbours(j, file2, file1, label2, label1);
239
                }
248
                }
240
            }
249
            }
241
        }        
250
        }        
242
    }
251
    }        
243
252
244
    private static void switchNeighbours (int j, File file2, File file1, String label2, String label1) {
253
    private static void switchNeighbours (int j, File file2, File file1, String label2, String label1) {
245
        javaLocations.set(j, file2);
254
        javaLocations.set(j, file2);
Lines 265-270 Link Here
265
            javaLabels.add(getLabel(javaHome));
274
            javaLabels.add(getLabel(javaHome));
266
        }
275
        }
267
    }
276
    }
277
    
268
    public static List <File> getJavaLocations() {
278
    public static List <File> getJavaLocations() {
269
        return javaLocations;
279
        return javaLocations;
270
    }
280
    }
Lines 328-333 Link Here
328
                final boolean isWindows = SystemUtils.isWindows();
338
                final boolean isWindows = SystemUtils.isWindows();
329
                final boolean isSolaris = SystemUtils.isSolaris();
339
                final boolean isSolaris = SystemUtils.isSolaris();
330
                final File[] children = parent.listFiles(new FileFilter() {
340
                final File[] children = parent.listFiles(new FileFilter() {
341
                    @Override
331
                    public boolean accept(final File pathname) {
342
                    public boolean accept(final File pathname) {
332
                        return pathname.isDirectory() && 
343
                        return pathname.isDirectory() && 
333
                                (!isSolaris || !pathname.equals(new File("/export/sybase"))) && //workaround for #143292
344
                                (!isSolaris || !pathname.equals(new File("/export/sybase"))) && //workaround for #143292
Lines 463-468 Link Here
463
            }
474
            }
464
        }
475
        }
465
    }
476
    }
477
        
466
    /////////////////////////////////////////////////////////////////////////////////
478
    /////////////////////////////////////////////////////////////////////////////////
467
    // Constants
479
    // Constants
468
    public static final String DEFAULT_TITLE =
480
    public static final String DEFAULT_TITLE =
Lines 536-543 Link Here
536
        "/usr/java/jdk", // NOI18N
548
        "/usr/java/jdk", // NOI18N
537
        "/usr/j2se", // NOI18N
549
        "/usr/j2se", // NOI18N
538
        "/usr/j2sdk", // NOI18N
550
        "/usr/j2sdk", // NOI18N
539
        
551
               
540
        
541
        "/usr/local", // NOI18N
552
        "/usr/local", // NOI18N
542
        "/usr/local/jdk", // NOI18N
553
        "/usr/local/jdk", // NOI18N
543
        "/usr/local/jdk/instances", // NOI18N
554
        "/usr/local/jdk/instances", // NOI18N
(-)a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/Bundle.properties (-1 / +1 lines)
Lines 131-137 Link Here
131
JLP.error.wrong.vendor.java=The specified Java environment folder contains Java from the unsupported vendor ({1}). The supported vendors are "{2}".
131
JLP.error.wrong.vendor.java=The specified Java environment folder contains Java from the unsupported vendor ({1}). The supported vendors are "{2}".
132
JLP.error.unknown=An unknown error occured while validating the path.
132
JLP.error.unknown=An unknown error occured while validating the path.
133
#NOI18N
133
#NOI18N
134
JLP.java.download.page=http://java.sun.com/javase/downloads
134
JLP.java.download.page=http://www.oracle.com/technetwork/java/javase/downloads/
135
#NOI18N
135
#NOI18N
136
JLP.java.download.page.mac=http://developer.apple.com/java/download
136
JLP.java.download.page.mac=http://developer.apple.com/java/download
137
JLP.error.nothing.found=\
137
JLP.error.nothing.found=\
(-)a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/ErrorMessagePanel.java (-5 / +5 lines)
Lines 51-62 Link Here
51
import org.netbeans.installer.utils.UiUtils;
51
import org.netbeans.installer.utils.UiUtils;
52
import org.netbeans.installer.utils.helper.NbiThread;
52
import org.netbeans.installer.utils.helper.NbiThread;
53
import org.netbeans.installer.utils.helper.swing.NbiLabel;
53
import org.netbeans.installer.utils.helper.swing.NbiLabel;
54
import org.netbeans.installer.wizard.ui.SwingUi;
55
import org.netbeans.installer.wizard.ui.WizardUi;
56
import org.netbeans.installer.wizard.components.WizardPanel;
54
import org.netbeans.installer.wizard.components.WizardPanel;
57
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelSwingUi;
55
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelSwingUi;
58
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelUi;
56
import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelUi;
59
import org.netbeans.installer.wizard.containers.SwingContainer;
57
import org.netbeans.installer.wizard.containers.SwingContainer;
58
import org.netbeans.installer.wizard.ui.SwingUi;
59
import org.netbeans.installer.wizard.ui.WizardUi;
60
60
61
/**
61
/**
62
 *
62
 *
Lines 234-240 Link Here
234
            }
234
            }
235
        }
235
        }
236
        
236
        
237
        protected String getWarningMessage() {
237
        protected String getWarningMessage() {                 
238
            return null;
238
            return null;
239
        }
239
        }
240
        
240
        
Lines 295-302 Link Here
295
        // private //////////////////////////////////////////////////////////////////
295
        // private //////////////////////////////////////////////////////////////////
296
        private void initComponents() {
296
        private void initComponents() {
297
            // errorLabel ///////////////////////////////////////////////////////////
297
            // errorLabel ///////////////////////////////////////////////////////////
298
            errorLabel = new NbiLabel();           
298
            errorLabel = new NbiLabel();
299
            
299
300
            // this /////////////////////////////////////////////////////////////////
300
            // this /////////////////////////////////////////////////////////////////
301
            add(errorLabel, new GridBagConstraints(
301
            add(errorLabel, new GridBagConstraints(
302
                    0, 99,                             // x, y
302
                    0, 99,                             // x, y
(-)a/nbi/engine/src/org/netbeans/installer/wizard/components/panels/JdkLocationPanel.java (-17 / +40 lines)
Lines 245-254 Link Here
245
                jreAllowed ? DEFAULT_ERROR_NOTHING_FOUND_JAVA : DEFAULT_ERROR_NOTHING_FOUND);
245
                jreAllowed ? DEFAULT_ERROR_NOTHING_FOUND_JAVA : DEFAULT_ERROR_NOTHING_FOUND);
246
    }
246
    }
247
    
247
    
248
    @Override
248
    public List<File> getLocations() {
249
    public List<File> getLocations() {
249
        return jdkLocations;
250
        return jdkLocations;
250
    }
251
    }
251
    
252
    
253
    @Override
252
    public List<String> getLabels() {
254
    public List<String> getLabels() {
253
        return jdkLabels;
255
        return jdkLabels;
254
    }
256
    }
Lines 257-262 Link Here
257
        return "true".equals(getProperty(JRE_ALLOWED_PROPERTY));
259
        return "true".equals(getProperty(JRE_ALLOWED_PROPERTY));
258
    }
260
    }
259
    
261
    
262
    @Override
260
    public File getSelectedLocation() {
263
    public File getSelectedLocation() {
261
        // the first obvious choice is the jdk that has already been selected for
264
        // the first obvious choice is the jdk that has already been selected for
262
        // this product; if it has not yet been set, there are still lots of
265
        // this product; if it has not yet been set, there are still lots of
Lines 321-327 Link Here
321
    }
324
    }
322
    
325
    
323
    private File getJavaFirstItemInTheList() {
326
    private File getJavaFirstItemInTheList() {
324
        if(jdkLocations.size() == 0) {
327
        if(jdkLocations.isEmpty()) {
325
            return null;
328
            return null;
326
        }        
329
        }        
327
        if(isJreAllowed()) {
330
        if(isJreAllowed()) {
Lines 459-464 Link Here
459
        return closestLocation;
462
        return closestLocation;
460
    }
463
    }
461
    
464
    
465
    @Override
462
    public String validateLocation(final String path) {
466
    public String validateLocation(final String path) {
463
        final File file = new File(path);
467
        final File file = new File(path);
464
        
468
        
Lines 471-478 Link Here
471
            return StringUtils.format(
475
            return StringUtils.format(
472
                    getProperty(ERROR_NOT_VALID_PATH_PROPERTY), path);
476
                    getProperty(ERROR_NOT_VALID_PATH_PROPERTY), path);
473
        }
477
        }
474
        
478
                
475
        
476
        if (!file.exists()) {
479
        if (!file.exists()) {
477
            if(JavaUtils.getInfo(file)==null) { 
480
            if(JavaUtils.getInfo(file)==null) { 
478
                // JDK location does not exist and is not in the list of installable JDKs
481
                // JDK location does not exist and is not in the list of installable JDKs
Lines 488-509 Link Here
488
            if (!isJreAllowed() && !JavaUtils.isJdk(file)) {
491
            if (!isJreAllowed() && !JavaUtils.isJdk(file)) {
489
                return StringUtils.format(
492
                return StringUtils.format(
490
                        getProperty(ERROR_NOT_JDK_PROPERTY), path);                
493
                        getProperty(ERROR_NOT_JDK_PROPERTY), path);                
491
            }
494
            }          
492
        }
495
        }                
493
        
496
        
494
        Version version = JavaUtils.getVersion(file);
497
        Version version = getVersion(file);
495
        if (version == null) {
496
            for (Product jdk: Registry.getInstance().getProducts(JDK_PRODUCT_UID)) {
497
                if ((jdk.getStatus() == Status.TO_BE_INSTALLED) &&
498
                        jdk.getInstallationLocation().equals(file)) {
499
                    version = jdk.getVersion();
500
                }
501
            }
502
        }
503
        
498
        
504
        if (version == null) {
499
        if (version == null) {
505
            return StringUtils.format(getProperty(ERROR_UNKNOWN_PROPERTY), path);
500
            return StringUtils.format(getProperty(ERROR_UNKNOWN_PROPERTY), path);
506
        }
501
        }                
507
        
502
        
508
        if (version.olderThan(minimumVersion)) {
503
        if (version.olderThan(minimumVersion)) {
509
            return StringUtils.format(
504
            return StringUtils.format(
Lines 519-525 Link Here
519
                    path,
514
                    path,
520
                    version,
515
                    version,
521
                    maximumVersion);
516
                    maximumVersion);
522
        }
517
        }       
518
        
523
        String vendor = JavaUtils.getInfo(file).getVendor();
519
        String vendor = JavaUtils.getInfo(file).getVendor();
524
        if(!vendor.matches(vendorAllowed)) {
520
        if(!vendor.matches(vendorAllowed)) {
525
            return StringUtils.format(
521
            return StringUtils.format(
Lines 530-543 Link Here
530
        }
526
        }
531
        
527
        
532
        return null;
528
        return null;
533
    }
529
    }        
534
    
530
    
531
    @Override
535
    public void setLocation(final File location) {
532
    public void setLocation(final File location) {
536
        lastSelectedJava = location;
533
        lastSelectedJava = location;
537
        SearchForJavaAction.addJavaLocation(location);
534
        SearchForJavaAction.addJavaLocation(location);
538
        getWizard().setProperty(JDK_LOCATION_PROPERTY, location.getAbsolutePath());
535
        getWizard().setProperty(JDK_LOCATION_PROPERTY, location.getAbsolutePath());
539
    }
536
    }
540
    
537
    
538
    /**
539
     * Returns if JDK version is recommended - #218822
540
     * @param jdkPath
541
     * @return false if not recommended. If JDK does not exist returns true.
542
     */
543
    public boolean isJdkVersionRecommended(String jdkPath) {
544
        File jdkFile = new File(jdkPath);        
545
        Version version = getVersion(jdkFile);
546
        
547
        return version != null ? JavaUtils.isRecommended(version) : true;
548
    }
549
    
550
    private Version getVersion(File file) {
551
        Version version = JavaUtils.getVersion(file);
552
        
553
        if (version == null) {
554
            for (Product jdk : Registry.getInstance().getProducts(JDK_PRODUCT_UID)) {
555
                if ((jdk.getStatus() == Status.TO_BE_INSTALLED) && jdk.getInstallationLocation().equals(file)) {
556
                    version = jdk.getVersion();
557
                }
558
            }
559
        }
560
        
561
        return version;
562
    }
563
    
541
    private void addJavaLocationsFromProductDependencies() {
564
    private void addJavaLocationsFromProductDependencies() {
542
        // finally we should scan the registry for jdks planned for installation, if
565
        // finally we should scan the registry for jdks planned for installation, if
543
        // the current product is scheduled to be installed after 'jdk', i.e. has
566
        // the current product is scheduled to be installed after 'jdk', i.e. has
(-)a/o.n.bootstrap/launcher/unix/nbexec (-4 / +8 lines)
Lines 153-163 Link Here
153
        Darwin*)
153
        Darwin*)
154
        # read Java Preferences
154
        # read Java Preferences
155
        if [ -x "/usr/libexec/java_home" ]; then
155
        if [ -x "/usr/libexec/java_home" ]; then
156
            jdkhome=`/usr/libexec/java_home --version 1.6+`
156
            jdkhome=`/usr/libexec/java_home --version 1.7.0_10+ --failfast`
157
            if [ -z $jdkhome ]; then 
158
                jdkhome=`/usr/libexec/java_home --version 1.6 --failfast`
159
            fi
157
160
158
        # JDK1.7
161
        # JDK1.7 Update 10 as a fallback
159
        elif [ -f "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java" ] ; then
162
        elif [ -f "/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java" ] ; then
160
            jdkhome="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"
163
            jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home"
161
164
162
        # JDK1.6
165
        # JDK1.6
163
        elif [ -f "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ; then
166
        elif [ -f "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" ] ; then
Lines 167-172 Link Here
167
        elif [ -f "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java" ] ; then
170
        elif [ -f "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java" ] ; then
168
            jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
171
            jdkhome="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
169
        fi
172
        fi
173
        echo Found jdkhome=$jdkhome
170
        ;;
174
        ;;
171
        *) javac=`which javac`
175
        *) javac=`which javac`
172
        if [ -z "$javac" ] ; then
176
        if [ -z "$javac" ] ; then

Return to bug 218822