Intel® oneAPI Data Analytics Library
Learn from community members on how to build compute-intensive applications that run efficiently on Intel® architecture.

Java Eclipse Runtime Error

Hemanth_D_Intel
Employee
744 Views

Hi

I downloaded the daal update 2 and installed it on a windows system. I have been able to run the java examples using the .bat files. But, when I set up an Eclipse program, I am running into problems. The daal.jar is recognized (build goes through) but when I run an example, I get the following error:

Here I am running the simple LibraryVersionInfoExample

Exception in thread "main" java.lang.UnsatisfiedLinkError: no JavaAPI in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.intel.daal.service.LibraryVersionInfo.<clinit>(LibraryVersionInfo.java:47)
    at com.intel.daal.examples.services.LibraryVersionInfoExample.main(LibraryVersionInfoExample.java:37)

Is this a recognized problem or is it just my setup.

Regards

Hemanth

0 Kudos
3 Replies
Hemanth_D_Intel
Employee
744 Views

Was able to resolve the issue: I had not included the dll libraries in the System PATH. I added the following to the path variable;

.....\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\ia32_win\daal;

.....\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\ia32_win\tbb\vc_mt;

.....\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\ia32_win\compiler;

and it fixed the issue.

Regards

Hemanth

0 Kudos
Zhang_Z_Intel
Employee
744 Views

This error is because Intel DAAL Java library requires a native library (JavaAPI.dll on Windows, libJavaAPI.so on Linux). And your Eclipse project does not find this native library. There're multiple ways to fix this. But the cleanest and simplest way is this:

  1. Create a new project in your IDE. Copy a DAAL example file into this project. In your case, you copy LibraryVersionInfoExample.java into your project.
  2. Configure Build Path. Click on the "Source" tab under "Java Build Path". Expand the src branch. Locate "Native library location" and double-click to edit it. Give it this value (using Windows as an example but Linux should be similar): 

    C:/Program Files (x86)/Intel_sw_development_tools/compilers_and_libraries_2016/windows/redist/intel64_win/daal
  3. On the same window, click the "Libraries" tab. Click "Ad JARs" to add "daal.jar", which is found in the DAAL installation location on your computer.
  4. Click "OK" to save the configuration.
  5. Then select "Run Configurations" from the "Project" menu. Click the "Environment" tab.
  6. Add a new environment variable "Path". Give it this value:

    C:\Program Files (x86)\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\intel64_win\daal;C:\Program Files (x86)\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Intel_sw_development_tools\compilers_and_libraries_2016.0.049\windows\redist\intel64_win\tbb\vc_mt
  7. Click "Apply" and close the window.
  8. Now your code should run correctly inside Eclipse. 

We recognize that the current DAAL examples are not configured with IDE users in mind. It's not easy for a new user to use DAAL with a Java IDE. Hopefully, we will improve this in future releases.

 

0 Kudos
Hemanth_D_Intel
Employee
744 Views

Thank you Zhang. That was helpful.

However for the Linux based Eclipse, I needed to do the following to make it work;

1. Add the daal.jar to the build path (step 3 from Zhang)

2. Then select "Run Configurations" from the "Project" menu. Click the "Environment" tab. Add a new environment variable "LD_LIBRARY_PATH". Give it this value: (similar to step 5 and 6 from Zhang) Note "LD_LIBRARY_PATH" and not "Path"

/opt/intel/compilers_and_libraries_2016.0.056/linux/daal/lib/ia32_lin:/opt/intel/compilers_and_libraries_2016.0.056/linux/compiler/lib/ia32_lin:/opt/intel/compilers_and_libraries_2016.0.056/linux/tbb/lib/ia32_lin/gcc4.4

There was no need to add the Native Library Location under "Source" tab (step 2 from Zhang).

Thank you

Hemanth

0 Kudos
Reply