Downloading and Installing NetBeans IDE
6. NetBeans - Tips & Tricks: Java Application Development
- Choosing the JDK version for your program: Right-click on your project ⇒ "Properties" ⇒ "Source" node ⇒ You can select the JDK level of your project in pull-donw menu "Source/Binary Format".
- Enabling JDK 7 support: If JDK 7 is already installed in your system, right-click on your Project ⇒ "Properties" ⇒ "Source" node ⇒ "Source/Binary Format" ⇒ Select "JDK 7". Also check "Libraries" ⇒ Java Platform ⇒ JDK 7.
If JDK 7
is not installed/configured, install JDK 7. Add JDK 7 support to NetBeans via "Tool" menu ⇒ "Java Platforms" ⇒ "Add Platform...".
- Choosing Default Charset: Right-click on your project ⇒ "Properties" ⇒ "Source" node ⇒ "Encoding" ⇒ choose your desired charset for the text-file I/O from the pull-down menu.
- Enabling Unicode Support for File Encoding: Right-click on your project ⇒ "Properties" ⇒ "Source" node ⇒ "Encoding" ⇒ choose your Unicode encoding (e.g., UTF-8, UTF-16, UTF-16LE, UTF-16GE) for the text-file I/O.
- To include Javadoc/Source: Use "Library Manager" (select the "Tools" menu ⇒ "Libraries"); or "Java Platform Manager" (select "Tools" menu ⇒ "Java Platforms")
- Adding External JAR files & Native Libraries (".dll", ".lib", ".a", ".so"): Many external Java packages (such as JOGL, Java3D, JAMA, etc) are available to extend the functions of JDK. These packages typically provide a "
lib
" directory containing JAR files (".jar
") (Java Archive - a single-file package of Java classes) and native libraries (".dll
", ".lib
" for windows, ".a
", ".so
" for Linux and Mac).
To include an external JAR file (".jar
") into a project: Expand the project node ⇒ Right-click on "Libraries" ⇒ "Add JAR/Folder..." ⇒ Select the desired JAR file or the folder containing the classes.
If the external package contains many JAR files, you could create a user library to contain all the JAR files, and add the library to all the projects that required these JAR files. From "Tools" menu ⇒ "Libraries" ⇒ "New Library..." ⇒ Enter a library name ⇒ Use "Add JAR/Folder..." to add JAR files into this library.
Many JAR files come with native libraries in the form of ".dll
", ".lib
" (for Windows) and ".a
", ".so
" for Linux/Mac. The directory path of these libraries must be included in JRE's property "java.library.path
". This can be done via right-click the project ⇒ Set Configuration ⇒ Customize... ⇒ Run ⇒ In "VM options", enter "-Djava.library.path=xxx
", where xxx
is path of the native libraries.
Notes:
The JAR files must be included in the CLASSPATH
. The native library directories must be included in JRE's property "java.library.path
", which normally but not necessarily includes all the paths from the PATH
environment variable. Read "
External JAR files and Native Libraries".