我一直在努力认识到当前使用Tomcat和外部库(JCo)的Java Maven项目正在发生什么。
出于某种原因,System.getProperty("java.library.path")
结果与我的环境变量%PATH%
中的路径不匹配(默认)。
我不打算更改java.library.path
值或任何,我只想知道为什么 NOT DEFAULTING 到%PATH%变量。
以下是我如何确定它:
public static void main(String[] args) {
for (String path : System.getProperty("java.library.path")) {
System.out.println(path);
}
}
上面的代码段会导致:
C:\Program Files\Java\jre1.8.0_131\bin
C:\WINDOWS\Sun\Java\bin
C:\WINDOWS\system32
C:\WINDOWS
C:/Program Files/Java/jre1.8.0_131/bin/server
C:/Program Files/Java/jre1.8.0_131/bin
C:/Program Files/Java/jre1.8.0_131/lib/amd64
C:\ProgramData\Oracle\Java\javapath
C:\Program Files\Docker\Docker\Resources\bin
C:\Python27
C:\Python27\Scripts
C:Program Files\Git\bin
C:Program Files\Git\cmd
\C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Users\Unknown\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files (x86)\Microsoft Emulator Manager\1.0\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Git\cmd
C:\Program Files (x86)\nodejs\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Skype\Phone\
C:\Program Files\Java\jdk1.8.0_112\bin
D:\Arquivos de Programas\Apache Software Foundation\Maven 3.3.9\bin
C:\Pro
C:\Users\Unknown\AppData\Roaming\npm
C:\Users\Unknown\AppData\Local\Microsoft\WindowsApps
C:\Program Files\Eclipse Neon
.
... echo %PATH%
产生以下结果:
C:\Program Files\Docker\Docker\Resources\bin
C:\Python27
C:\Python27\Scripts
C:\WEEEEEEEEEEEIRD\PAAAAAAAATHHHHHH\FOR MAVEN EXAMPLE
C:Program Files\Git\bin
C:Program Files\Git\cmd
\C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Users\Unknown\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files (x86)\Microsoft Emulator Manager\1.0\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Git\cmd
C:\Program Files (x86)\nodejs\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Skype\Phone\
C:\Program Files\Java\jdk1.8.0_112\bin
D:\Arquivos de Programas\Apache Software Foundation\Maven 3.3.9\bin
D:\Arquivos de Programas\SAP\JCo
C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Users\Unknown\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files (x86)\Microsoft Emulator Manager\1.0\
C:\Program Files (x86)\nodejs\
C:\Program Files (x86)\Skype\Phone\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\
C:\Pro
C:\Users\Unknown\AppData\Roaming\npm
C:\Users\Unknown\AppData\Local\Microsoft\WindowsApps
正如我们所看到的,%PATH%
中的“C:\ WEEEEEEEEEEEIRD \ PAAAAAAAATHHHHHH \ FOR MAVEN EXAMPLE”未显示在java.library.path
中。此路径包含项目所需的DLL。
可能有什么不对?非常感谢提前!
我正在使用:
的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.nooder</groupId>
<artifactId>Hibersap</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hibersap</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.hibersap</groupId>
<artifactId>hibersap-core</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.hibersap</groupId>
<artifactId>hibersap-jco</artifactId>
<version>1.3.0</version>
</dependency>
<!-- mvn install:install-file -DgroupId=org.hibersap -DartifactId=com.sap.conn.jco.sapjco3 -Dversion=3.0.16 -Dpackaging=jar -Dfile="C:\somewhere\sapjco3.jar" -->
<dependency>
<groupId>org.hibersap</groupId>
<artifactId>com.sap.conn.jco.sapjco3</artifactId>
<version>3.0.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<propertyName>java.library.path</propertyName>
<buildDirectory>D:\Arquivos de Programas\SAP\JCo</buildDirectory>
</systemPropertyVariables>
</configuration>
</plugin>
-->
</plugins>
</build>
</project>