简体   繁体   中英

Pass env var from java to c++

Is there a way to set an environment variable or some kind of global variable in java so it can be visible from within the c++ code that I call from java (using swig). Off course as a workaround I can expose another function which will track the value of env var in some static variable in c++, so I can use it when it is needed. However it is interesting if there is a way to set env or global variable in java and make it visible in c++ code called from java.

Best regards -Grigor

There are ways to set environment variables in Java but they are not particularly nice, see this previously asked question .

I think your best bet would be to use JNI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM