Java Application Development(包括如何设置本地库)

  1. 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".
  2. 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...".
  3. 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.
  4. 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.
  5. To include Javadoc/Source: Use "Library Manager" (select the "Tools" menu ⇒ "Libraries"); or "Java Platform Manager" (select "Tools" menu ⇒ "Java Platforms")
  6. Adding External JAR files & Native Libraries (dll, lib): Many external Java packages (such as JOGL, Java3D, JAMA, etc) are available to extend the functions of JDK. These binaries are often provided in a "lib" directory with jar files and native libraries (dll and lib).
    To include an external JAR file 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 or lib. 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.
    If you get a runtime error "java.lang.UnsatisfiedLinkError: no xxx in java.library.path", which means that JRE cannot find your native library at runtime. The easier way to debug is to print out the contents of "java.library.path" via System.out.println(System.getProperty("java.library.path")). You could set the native library path via the command-line VM option -Djava.library.path=xxx.
——————————————————————————————————
傲轩游戏网
原文地址:https://www.cnblogs.com/cuizhf/p/2232595.html