Project
The project is a large C # project that is used to automate testing. To do this, I must use a java tool, which is a tool that saves all the results to a file that can be loaded into the test environment.
Interface
I got a DLL from a test environment provider that is built in C ++, this DLL loads the java environment and loads the jar files.
Current situation
The java environment was loaded successfully, setting it up using environment variables set in C # using this method:
String java = GetJavaInstallationPath(); Environment.SetEnvironmentVariable("PATH", String.Format("{0};{1}", Environment.GetEnvironmentVariable("PATH"), Path.Combine(java, @"bin\client")), EnvironmentVariableTarget.Process);
After that, I set the path to the Java classes using this code:
Environment.SetEnvironmentVariable("ITEPCLASSPATH", String.Format("{0};{1}", Path.Combine(iTepPath, "itep.jar"), Path.Combine(iTepPath, "libs\\itorx.jar")), EnvironmentVariableTarget.Process);
What actually should work, it shows the correct value when using Environment.GetEnvironmentVariable("ITEPCLASSPATH") , but the C ++ - DLL tells me that it is not working.
When setting the class path using an external bat file, it works. Some more facts:
- The application is launched by the bat file.
- The path is copied from my generated dll path
- I am not commenting anything, so the path is still set by C #
It seems that java does not have access to the env.-i variable set in C #, but recognizes that I installed it in the bat file.
I really need to set a variable via C #, how to do this?