You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Neil Aggarwal <ne...@propfinancing.com> on 2024/01/05 16:40:37 UTC
How to pass java.library.path to mvn exec?
Hello:
I am trying to pass java.library.path to a mvn exec command.
Here is what I tried:
mvn exec:java -Dexec.mainClass=com.fiscalassets.tax.PrintForm1098s
-Dexec.args=application.properties.FiscalAssets
-Djava.library.path=C:\OneDrive\Dev\Jacob
But, I get an error:
[ERROR] Failed to execute goal
org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project
FAIntegration:
An exception occurred while executing the Java class. no jacob-1.20-x64 in
java.library.path:
C:\Program
Files\Java\jdk-17\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Cygwin\usr\local\bin;C:\Cygwin\bin;C:\Program
Files\Common
Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
Corporation\NVIDIA
NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program
Files\Google\Google Apps Sync;C:\Program
Files\Maven\bin;C:\Users\neil\AppData\Local\Microsoft\WindowsApps;. ->
[Help 1]
The directory I passed to the command is not listed I the set of
directories in the output so I can only
assume the argument did not work.
I searched but I can’t find any info on this. Any idea what I am doing
wrong?
Thank you,
Neil
--
Neil Aggarwal, 972-834-1565, http://propfinancing.com
We offer 30 year loans on single family houses!
Re: How to pass java.library.path to mvn exec?
Posted by Francois Marot <fr...@gmail.com>.
for the record, I find it simpler to hardcode it in the pom like this:
<arguments><argument>-Djava.library.path=...
Here is my pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>runUnobfuscated</id>
<configuration>
<executable>java</executable>
<environmentVariables>
<!-- LD_LIBRARY_PATH is used only on Linux -->
<LD_LIBRARY_PATH>${session.executionRootDirectory}/${buildDirectory}/natives/:${java.home}/lib/amd64/</LD_LIBRARY_PATH>
<!-- you should define different profiles for each env Linux/win -->
<PATH>${PATH};${session.executionRootDirectory}/${buildDirectory}/natives/;${java.home}/lib/amd64/</PATH>
<OIV_JAVA_VERBOSE_LEVEL>0</OIV_JAVA_VERBOSE_LEVEL>
</environmentVariables>
<inheritIo>true</inheritIo>
<longModulepath>true</longModulepath>
<arguments>
<argument>-Djava.library.path
=${session.executionRootDirectory}/${buildDirectory}/natives/;${session.executionRootDirectory}/${buildDirectory}/natives/xxxx/jre/bin</argument>
<argument>-Ddev=true</argument>
<argument>-Duser.language=en</argument>
<argument>-XX:MaxDirectMemorySize=1024m</argument>
[...]
Le sam. 6 janv. 2024 à 16:20, Neil Aggarwal <ne...@propfinancing.com> a
écrit :
> > As far as I get you should pass java.library.path in the java executable
> > arguments
>
> Yes, that worked, thank you!
>
> Thank you,
> Neil
>
> --
> Neil Aggarwal, 972-834-1565, http://propfinancing.com
> We offer 30 year loans on single family houses!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
RE: How to pass java.library.path to mvn exec?
Posted by Neil Aggarwal <ne...@propfinancing.com>.
> As far as I get you should pass java.library.path in the java executable
> arguments
Yes, that worked, thank you!
Thank you,
Neil
--
Neil Aggarwal, 972-834-1565, http://propfinancing.com
We offer 30 year loans on single family houses!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to pass java.library.path to mvn exec?
Posted by Stanimir Stamenkov <s7...@netscape.net.INVALID>.
Sat, 6 Jan 2024 00:29:57 -0600, /Neil Aggarwal/:
> OK, so I changed to try to use the exec:exec goal.
> I updated the goal in my pom.xml (Attached) and tried this command line:
>
> mvn exec:exec -Dexec.executable="java" -Dexec.args="-cp %classpath
> com.fiscalassets.tax.PrintForm1098s application.properties.FiscalAssets"
>
> I still get this error:
> [...]
>
> It is not using the java.library.path I am giving it.
As far as I get you should pass java.library.path in the java executable
arguments:
mvn exec:exec -Dexec.executable="java"
-Dexec.args="-Djava.library.path=... application.properties.FiscalAssets"
Alternatively, with exec:java try setting MAVEN_OPTS:
set MAVEN_OPTS=-Djava.library.path=...
mvn exec:java ...
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: How to pass java.library.path to mvn exec?
Posted by Neil Aggarwal <ne...@propfinancing.com>.
> you either need to set it for the whole Maven process or fork your
> execution, using exec:exec instead of exec:java.
OK, so I changed to try to use the exec:exec goal.
I updated the goal in my pom.xml (Attached) and tried this command line:
mvn exec:exec -Dexec.executable="java" -Dexec.args="-cp %classpath
com.fiscalassets.tax.PrintForm1098s application.properties.FiscalAssets"
I still get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob-1.20-x64
in java.library.path: C:\Program
Files\Java\jdk-17\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Cygwin\usr\local\bin;C:\Cygwin\bin;C:\Program
Files\Common
Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
Corporation\NVIDIA
NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program
Files\Google\Google Apps Sync;C:\Program
Files\Maven\bin;C:\Users\neil\AppData\Local\Microsoft\WindowsApps;.
It is not using the java.library.path I am giving it.
Thank you,
Neil
--
Neil Aggarwal, 972-834-1565, http://propfinancing.com
We offer 30 year loans on single family houses!
Re: How to pass java.library.path to mvn exec?
Posted by Alexander Kriegisch <al...@kriegisch.name>.
If you carefully read the docs that Nils pointed you to, ...
>> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#systemProperties
... it says:
> Note: as the execution is not forked, some system properties required
> by the JVM cannot be passed here. Use MAVEN_OPTS or the exec:exec
> instead. See the user guide for more information.
java.library.path is one such property. It is read a single time when
the JVM starts and then never again. From the JDK source code of class
jdk.internal.util.StaticProperty:
static {
Properties props = System.getProperties();
JAVA_HOME = getProperty(props, "java.home");
USER_HOME = getProperty(props, "user.home");
USER_DIR = getProperty(props, "user.dir");
USER_NAME = getProperty(props, "user.name");
JAVA_IO_TMPDIR = getProperty(props, "java.io.tmpdir");
JAVA_LIBRARY_PATH = getProperty(props, "java.library.path", "");
// ...
}
I.e., you either need to set it for the whole Maven process or fork your
execution, using exec:exec instead of exec:java.
--
Alexander Kriegisch
https://scrum-master.de
Neil Aggarwal schrieb am 06.01.2024 05:08 (GMT +07:00):
> OK, I set the system property in my pom.xml file, see attached.
>
> But I still get the same error when I run this command:
> mvn
> exec:java -Dexec.mainClass=com.fiscalassets.tax.PrintForm1098s
> -Dexec.args=application.properties.FiscalAssets
>
> [ERROR] Failed to execute goal
> org.codehaus.mojo:exec-maven-plugin:3.1.1:java (default-cli) on project
> FAIntegration: An exception occurred while executing the Java class. no
> jacob-1.20-x64 in java.library.path:
>
> ...
>
> The directory is not even listed in the directory list the JVM is searching
> for.
>
> Did I get the configuration wrong?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: How to pass java.library.path to mvn exec?
Posted by Neil Aggarwal <ne...@propfinancing.com>.
OK, I set the system property in my pom.xml file, see attached.
But I still get the same error when I run this command:
mvn
exec:java -Dexec.mainClass=com.fiscalassets.tax.PrintForm1098s
-Dexec.args=application.properties.FiscalAssets
[ERROR] Failed to execute goal
org.codehaus.mojo:exec-maven-plugin:3.1.1:java (default-cli) on project
FAIntegration: An exception occurred while executing the Java class. no
jacob-1.20-x64 in java.library.path: C:\Program
Files\Java\jdk-17\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Cygwin\usr\local\bin;C:\Cygwin\bin;C:\Program
Files\Common
Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
Corporation\NVIDIA
NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program
Files\Google\Google Apps Sync;C:\Program
Files\Maven\bin;C:\Users\neil\AppData\Local\Microsoft\WindowsApps;. -> [Help
1]
The directory is not even listed in the directory list the JVM is searching
for.
Did I get the configuration wrong?
Thank you,
Neil
--
Neil Aggarwal, 972-834-1565, http://propfinancing.com
We offer 30 year loans on single family houses!
Re: How to pass java.library.path to mvn exec?
Posted by Nils Breunese <ni...@breun.nl>.
Hi Neil,
java.library.path is a system property. The Exec Maven Plugin documentation for exec:java and system properties is here: https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#systemProperties
Nils.
> Op 5 jan 2024, om 17:40 heeft Neil Aggarwal <ne...@propfinancing.com> het volgende geschreven:
>
> Hello:
>
>
>
> I am trying to pass java.library.path to a mvn exec command.
>
>
>
> Here is what I tried:
>
> mvn exec:java -Dexec.mainClass=com.fiscalassets.tax.PrintForm1098s
> -Dexec.args=application.properties.FiscalAssets
> -Djava.library.path=C:\OneDrive\Dev\Jacob
>
>
>
> But, I get an error:
>
> [ERROR] Failed to execute goal
> org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project
> FAIntegration:
>
> An exception occurred while executing the Java class. no jacob-1.20-x64 in
> java.library.path:
>
> C:\Program
> Files\Java\jdk-17\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Cygwin\usr\local\bin;C:\Cygwin\bin;C:\Program
> Files\Common
> Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
> Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA
> Corporation\NVIDIA
> NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program
> Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program
> Files\Google\Google Apps Sync;C:\Program
> Files\Maven\bin;C:\Users\neil\AppData\Local\Microsoft\WindowsApps;. ->
> [Help 1]
>
>
>
> The directory I passed to the command is not listed I the set of
> directories in the output so I can only
>
> assume the argument did not work.
>
>
>
> I searched but I can’t find any info on this. Any idea what I am doing
> wrong?
>
>
>
> Thank you,
>
> Neil
>
>
>
> --
>
> Neil Aggarwal, 972-834-1565, http://propfinancing.com
>
> We offer 30 year loans on single family houses!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org