I've been struggling for days to recognize what is going on with my current Java Maven project that uses Tomcat and external libraries (JCo).
For some reason, the System.getProperty("java.library.path")
result does not match the paths from my enviroment variable %PATH%
(default).
I do NOT intend to change the java.library.path
value or whatsoever, I just want to know why it is NOT DEFAULTING to the %PATH% variable.
Here's how I identified it:
public static void main(String[] args) {
for (String path : System.getProperty("java.library.path")) {
System.out.println(path);
}
}
The above snippet results in:
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
.
...while the echo %PATH%
produces the following results:
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
As we can see, the "C:\WEEEEEEEEEEEIRD\PAAAAAAAATHHHHHH\FOR MAVEN EXAMPLE" from %PATH%
does not show in the java.library.path
. This path contains the required DLL for my project.
What could be wrong? Thanks a lot in advance!
I'm using:
- Windows 10 x64
- Maven 3.3.9
- Tomcat 9
- Java 8
- Eclipse Neon
- JCo 3 (SAP Java Connector)
- Hibersap 1.3.0 (JCo "wrapper")
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>