Code Monkey home page Code Monkey logo

Comments (2)

JuicyDragon avatar JuicyDragon commented on June 24, 2024

Hello @VelpukondaRameshLio

Can you share the main method of your code? My first guess (without seeing that code) would be that the engine release directory is not being referenced or the engine bin and bin/x86 directories are not on the PATH environment variable (assuming you are on Windows).

If you are attempting to execute one of the examples in the repository, note that they pass on the Java system property value in nuix.engineDir when constructing the EngineWrapper instance.

https://github.com/Nuix/Nuix-Java-Engine-Baseline/blob/master/IntelliJ/src/main/java/com/nuix/javaenginesimple/examples/BasicInitializationExample.java#L29-L34

If you do no supply that as an argument (which your example command does not) then I could imagine an issue like this occurring.

I believe you will want to add a few more startup arguments:

  • -Dnuix.engineDir="<ENGINE_RELEASE_DIRECTORY_HERE>"
  • -Dnuix.logDir="<LOG_DIRECTORY_HERE>"
  • -Djava.io.tmpdir="<TEMP_DIRECTORY_HERE>"

You want to make sure that the PATH environment variable includes the paths to the engine bin and bin/x86 directories. The Gradle build file automatically accomplishes this for you during tests using these lines:

String envPath = engineBinDirectory + ";" + engineX86BinDirectory
...
...
setEnvironment(["PATH":envPath])

https://github.com/Nuix/Nuix-Java-Engine-Baseline/blob/master/IntelliJ/build.gradle#L45
https://github.com/Nuix/Nuix-Java-Engine-Baseline/blob/master/IntelliJ/build.gradle#L76

But when running from a Jar independent of that, the PATH variable needs to be set for the JVM process either by having it configured in the PATH environment variable for the system or user, or starting the JVM using something that can configure that for just the JVM process. An example of this is using SETLOCAL/ENDLOCAL (docs) in a batch file which runs your command. Another example would be starting the JVM process using Process class in .NET which allows you to modify environment variable for a process like this:

Process nuixProcess = new Process();
...
...
string engineBinDir = "<ENGINE_BIN_DIR>";
string enginex86BinDir = "<ENGINE_X86_BIN_DIR>";
string existingPath = Environment.GetEnvironment("PATH");
nuixProcess.StartInfo.EnvironmentVariables.Add("PATH", existingPath+";"+engineBinDir+";"+enginex86BinDir );

from nuix-java-engine-baseline.

JuicyDragon avatar JuicyDragon commented on June 24, 2024

So as an example of confirming what the PATH is set to, you could have this code run very early on in your project:

// Print out the current PATH env var as seen by the process this code resides in
String currentPath = System.getenv("PATH");
System.out.println("Current PATH: "+currentPath);

Which should result in output like the following

Current PATH: D:\NuixEngineRelease\bin;D:\NuixEngineRelease\bin\x86

As you can see, my PATH points to both bin and bin/x86 directories of my Nuix engine release.

from nuix-java-engine-baseline.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.