Comments (3)
Hello @chrishaupt, I believe the way Nuix Workstation (the GUI) gets around not having to have the OS Path
environment variable include every installed version of Nuix is by setting the Path
environment variable for the JVM process started up by nuix_app.exe
.
For example, if you start Nuix Workstation and then run the following Ruby script in the script console:
# Get environment variable "Path"
puts java.lang.System.getenv("Path").gsub(";","\n")
You should see output similar to the following:
C:\Program Files\Nuix\Nuix 9.2\bin
C:\Program Files\Nuix\Nuix 9.2\bin\amd64
C:\Program Files\Nuix\Nuix 9.2\bin\x86
C:\Program Files\Nuix\Nuix 9.2\jre\bin
C:\Program Files\Nuix\Nuix 9.2\jre\bin\server
C:\Python39\Scripts\
C:\Python39\
C:\WINDOWS\system32
C:\WINDOWS
etc...
If I then open a command prompt and echo the same variable using:
ECHO %path%
I instead get a listing without the Nuix path entries:
C:\Python39\Scripts\
C:\Python39\
C:\WINDOWS\system32
C:\WINDOWS
etc...
You see that while from the perspective of the running Nuix Java process those path values are present, the OS doesn't have them. So I believe nuix_app.exe
is doing the following:
- Start JVM process which runs the Nuix main method
- Inject into the
Path
environment variable of that JVM process the relevant additional path entries
The way I might approach this is by writing a similar executable that starts up my JVM/Nuix engine process. I rather like C#/.NET so below here is a snippet that demonstrates the general concept in C#/.NET using the Process class:
// The paths you have decided to add through whatever means, such as
// a little GUI that user selects version they want to run against
string[] additionalPaths = new string[] {
"D:\engine-releases\9.0.1.325\bin",
"D:\engine-releases\9.0.1.325\bin\x86",
};
Process engineProcess = new Process();
// The executable to execute
engineProcess.StartInfo.FileName = "C:\Path\To\java.exe";
// The arguments provided to executable above, things like class path, fully qualified name of class
// with static main method, maybe even Nuix specific arguments, etc
engineProcess.StartInfo.Arguments = "-classpath \"D:\\engine-releases\\9.0.1.325\\lib\\*;.\\*\" com.nuix.javaenginesimple.examples.BasicInitializationExample"
// Any additional process configuration you may want to set
engineProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
engineProcess.StartInfo.CreateNoWindow = true;
// Perhaps additional configuration such as standard out and standard error redirection, etc...
// Modify the "Path" environment variable of only the JVM process we are about to start
for (string additionalPath in additionalPaths) {
engineProcess.EnvironmentVariables["Path"] += ";"+additionalPath;
}
// Start the process
engineProcess.Start();
from nuix-java-engine-baseline.
Thank you for this in depth answer! I thought about starting my applikation via batch script (SET Path/to/Bin). But your idea is much more convenient.
from nuix-java-engine-baseline.
Hello @chrishaupt, I wanted to add that the batch file approach can work in a similar manner by using SETLOCAL and ENDLOCAL
commands, which allows you to localize the modifications to environment variables to just between those 2 commands. I've used both approaches (C#/.NET and batch file) to temporarily set environment variables NUIX_USERNAME
and NUIX_PASSWORD
to temporarily provide NMS credentials when running a script headless via nuix_console.exe
.
from nuix-java-engine-baseline.
Related Issues (12)
- Thirdparty dependency checker issue HOT 3
- java.lang.NoClassDefFoundError when switching to Nuix Engine engine-dist-win32-amd64-9.6.6.317 HOT 3
- What is this? HOT 5
- LicenseProperties class not found in nuix-scripting-api-9.10.9.584.jar HOT 1
- Not working in executable jar HOT 2
- Basic example is not working: ClassNotFoundException for org.picocontainer.MutablePicoContainer HOT 4
- Incorporate system property 'nuix.libdir' HOT 1
- CLS license support HOT 2
- How do i implement Processor for addeing evidence to case HOT 2
- CLS licence never gets released HOT 3
- Execution hangs after iterating over available server licenses HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuix-java-engine-baseline.