Example: Creating a native library import problem for an SWT project

Source: Internet
Author: User
Tags copy include variable win32
Create | problem | project

For Eclipse 3.1.x, there is no "org.eclipse.swt.win32_3.0.1" directory mentioned in the book, and there is no natural swt.jar and Swt-win32-3063.dll in the directory, which is in eclipse 3.1.x is replaced by Org.eclipse.swt.win32.win32.x86_3.1.x.jar file, and the original library file is compressed into this jar file, with WinRAR decompression can be obtained.

When SWT Designer is installed, all the necessary jar files are automatically imported into the project without manual import, but if the Org.eclipse.swt.win32.win32.x86_3.1.x.jar file was previously uncompressed, Please delete the extracted directory before you establish the project, or you will import an error. This error is due to the import of the "org.eclipse.swt.win32.win32.x86_3.1.x" directory, which can be manually modified to import the entire jar file OK.

Next came the introduction of the native library, and I found the problem of importing the native library into the project (actually copying the Swt-win32-xxxx.dll file to the project root) with the method in the book. Later check "Swt/jface in action" learned that there are many ways to import the original library, but the author found that the best way is to copy the Swt-win32-xxxx.dll file directly to the "$Java \jre\bin" directory, so that will not cause a lot of problems.

  Summarize the steps to resolve:

① installs Eclipse 3.1.x and SWT Designer to extract org.eclipse.swt.win32.win32.x86_3.1.x.jar files.

② copy Swt-win32-xxxx.dll to the "$Java \jre\bin" directory.

③ Delete the extracted Org.eclipse.swt.win32.win32.x86_3.1.x.jar folder.

④ new Swt/jface Java Project, and then you can create a new SWT class file directly without importing the native package.

PS: Recommended reference to "swt/jface in action" with "Eclipse Introduction and Mastery" to learn. You can find a story about importing a native graphics library in the 316 pages of the Appendix "Creating Projects with Swt/jface" of swt/jface in action:

Once you ' ve found the graphics library, your need to make sure the Application Launcher can use it. The documentation lists a number of ways to does this, but we ' ve found and adding a copy to the $JAVA/jre/bin directory wor KS best.

Other methods, which can be less reliable, include the following:

Option 1:copy and paste these files are directly in the Widgetwindow project.

Option 2:include the native library in any directory pointed to by the Java.library.path variable. This variable, among others, can is seen by clicking Eclipse help->about Details.

Option 3:go to control panel->system->advanced->environmental Variables and update the PATH variable with the DI Rectory containing the library file.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.