Search code examples
javanetbeans-7netbeans-platform

Packaging a Java Project in NetBeans IDE7.4 gives error


Packaging a Java Project in NetBeans IDE7.4 gives below error, but I have latest SDK Java 1.7 u45 installed.

Detected JavaFX Ant API version 1.0
C:\Users\Nandita\Documents\RealTimePackageMonitoringandTracking-master\code\SensorConfiguration\nbproject\build-native.xml:314: Error:
JavaFX native packager requires NetBeans to run on JDK 1.7u6 or later !

Solution

  • You can specify the JDK to run NetBeans on. See FaqJdkHome - NetBeans.

    Content copied into this answer in case the link goes dead.

    Command line config for NetBeans runtime JDK

    Use the --jdkhome <path> option when starting NetBeans. <path> is the root of the JDK installation.

    The NetBeans installer looks for suitable JDK installations available on user's system and allows the user to select the one she wants to run NetBeans with. For the installer (6.0-M10) itself use --javahome <path>. However, the setting may become obsolete when the user installs a new JDK later, or may be inconvenient when you want to run the IDE with another JDK. That's where the --jdkhome switch comes handy.

    Windows

    netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
    

    Unix

    netbeans --jdkhome /usr/bin/jdk1.6.0_20
    

    Permanent config file setting for NetBeans runtime JDK

    If you want to set the option permanently, you can do so in the netbeans.conf file.

    # Default location of JDK, can be overridden by using --jdkhome <dir>:
    netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_20"
    

    Finding the Configuration File

    There are actually two versions of the netbeans.conf file, a global and a local one.

    Global: If you want to change the settings globally for all users using a shared NetBeans installation, modify the global instance of the file. You find it in the NetBeans installation directory:

    ${nb-install}/etc/netbeans.conf
    

    Local: To make individual changes that will apply only to a specific user, put them into the etc/netbeans.conf file in the user's userdir .

    ${userdir}/etc/netbeans.conf
    

    The local file does not exist by default! If you don't see a ${userdir}/etc directory you have to create the file yourself. The easiest way to do that is to copy the global netbeans.conf file from the NetBeans installation folder to the local ${userdir}/etc folder, and then make the desired changes.

    Examples of the netbeans.conf file path:

    On Mac OS X: Ctrl-click /Applications/NetBeans/NetBeans IDE 6.5.app in the Finder and choose 'show package contents', then browse to:

    /Applications/NetBeans/NetBeans\ IDE\ 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf
    

    On Windows:

    C:\Program Files\Netbeans\etc\netbeans.conf
    

    On Linux the installer lets the user choose where you want to install NetBeans. You may find it under:

    /home/yourname/netbeans/etc/netbeans.conf 
      or 
    /opt/netbeans/etc/netbeans.conf.