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.
</api>
</li>
</ul>
<api name="JDKCheck" type="export" group="property" category="devel">
The <q>JDK check</q> API is a special contract between the core/startup
module and branded applications on top of it, that allows to perform
a check for a special class to be available during execution of
NetBeans based application. If it is missing a warning dialog is shown
and user can cancel the execution. The contract is based on
branding keys from
<a href="http://www.netbeans.org/source/browse/core/startup/src/org/netbeans/core/startup/Bundle.properties?rev=1">
org/netbeans/core/startup/Bundle.properties</a> file:
<ul>
<li><code>JDK_CLASS_TO_CHECK</code> - shall contain the class to check for</li>
<li><code>MSG_NEEDJDK_TITLE</code> - the title of the dialog</li>
<li><code>MSG_NEEDJDK</code> - the text of the message</li>
</answer>
This property cannot be changed while the IDE is running, so this attempt had no effect.
# {0} - JAR file name
TEXT_patch=Module patch or custom extension: {0}
#
# Jdk check
# NOI18N - provide name of a class from JDK you wish to load to ensure that we really run on JDK
JDK_CLASS_TO_CHECK=null
# {0} - path to JRE
# {1} - messages
MSG_NEEDJDK=It seems that your application is running on Java Runtime Environment\n \
from directory {0}.\n \
However in order to be fully functional it needs JDK. Please use the --jdkhome\n \
command line switch to specify the path to your JDK.
MSG_NEEDJDK_TITLE=This application can run only on JDK!
StartLog.logProgress ("Upgrade wizard consulted"); // NOI18N
//
// JDK check
String classToCheck = NbBundle.getMessage(Main.class, "JDK_CLASS_TO_CHECK"); // NOI18N
if (!"null".equals(classToCheck)) { // NOI18N
try {
Class.forName(classToCheck);
} catch (ClassNotFoundException ex) {
String h = System.getProperty("jdk.home");
if (h == null) {
h = System.getProperty("java.home");
}
String msg = NbBundle.getMessage(Main.class, "MSG_NEEDJDK", h, ex.getMessage()); // NOI18N
String title = NbBundle.getMessage(Main.class, "MSG_NEEDJDK_TITLE", h, ex.getMessage()); // NOI18N
int result = JOptionPane.showConfirmDialog(null, msg, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (result != JOptionPane.OK_OPTION) {
org.netbeans.TopSecurityManager.exit(5);
// 8.5 - we can show the splash only after the upgrade wizard finished
LBL_splash_window_title=Starting NetBeans IDE
currentVersion=NetBeans IDE Dev (Build {0})
# NOI18N - We need to run on JDK that provides debugger
JDK_CLASS_TO_CHECK=com.sun.jdi.VirtualMachineManager
# MSG_NEEDJDK=...
MSG_NEEDJDK_TITLE=NetBeans IDE can run only on JDK!