Error Message
When compiling or executing a Java application This uses the ArcObjects Java API, the following error is returned:
Java.lang.UnsatisfiedLinkError:no NTVINV in Java.library.path
Cause
The PATH variable does not include a directory which contains the native libraries required for ArcObjects Java classes to function.
Solution or workaround
Add The directory that is contains the native libraries needed by ArcObjects Java to the PATH variable.
On Windows, the must modify your PATH system variable to include either:
%AGSDESKTOPJAVA%\java\jre\bin %AGSDESKTOPJAVA%\bin
1 Packagecom.ys.test;2 3 //Example 1:hello arcobjects!4 Importjava.io.IOException;5 Importcom.esri.arcgis.system.AoInitialize;6 ImportCom.esri.arcgis.system.EngineInitializer;7 ImportCom.esri.arcgis.system.esriLicenseProductCode;8 ImportCom.esri.arcgis.system.esriLicenseStatus;9 ImportCom.esri.arcgis.carto.MapServer;Ten Public classenginehelloworld{ One Public Static voidMain (string[] args) { A Try{ - //Step 1:initialize The Java componet Object Model (COM) Interop. - engineinitializer.initializeengine (); the - //Step 2:initialize an ArcGIS license. -Aoinitialize Aoinit =Newaoinitialize (); - initializearcgislicenses (aoinit); + - //Step 3:invoke ArcObjects. +MapServer MapServer =NewMapServer (); A atString Devkitinstalldir = system.getenv ("Agsdesktopjava"); - -Mapserver.connect (Devkitinstalldir + -"/maptemplates/traditional Layouts/world/europe.mxd"); - -String name =mapserver.getdefaultmapname (); in -System.out.println ("Hello, arcobjects!:" +name); to + //Step 4:release the license. - Aoinit.shutdown (); the } * Catch(IOException ex) { $ System.out.println (Ex.getmessage ());Panax NotoginsengSystem.out.println ("App failed.")); - } the}//End of method Main. + A //License Initialization the Static voidinitializearcgislicenses (aoinitialize aoinit) { + Try{ - if(aoinit.isproductcodeavailable $(esrilicenseproductcode.esrilicenseproductcodeengine) = = $ esrilicensestatus.esrilicenseavailable) { - aoinit.initialize - (esrilicenseproductcode.esrilicenseproductcodeengine); the } - Else if(aoinit.isproductcodeavailableWuyi(esrilicenseproductcode.esrilicenseproductcodebasic) = = the esrilicensestatus.esrilicenseavailable) { - aoinit.initialize (esrilicenseproductcode.esrilicenseproductcodebasic) Wu ; - } About Else{ $ System.err.println ( -"Engine Runtime or Desktop Basic license not initialized."); -System.err.println ("Exiting application."); -System.exit (-1); A } + } the Catch(Exception e) { - e.printstacktrace (); $ } the}//End of Method Initializearcgislicenses the}//End of Class:enginehelloworld.Hello World
http://desktop.arcgis.com/en/arcobjects/latest/java/
http://support.esri.com/technical-article/000007942
Http://edndoc.esri.com/arcobjects/9.1/default.asp? Url=/arcobjects/9.1/arcgisdevhelp/developmentenvs/java/javaarcgisprogramming.htm
Error:java.lang.UnsatisfiedLinkError:no NTVINV in Java.library.path