在C ++中获取java.home的位置 [英] Get location of java.home in C++

查看:127
本文介绍了在C ++中获取java.home的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C ++应用程序中获取java.home的位置的最好方法是什么?现在我从注册表中获取它,但我想知道是否有更好,更容易/更干净的方式。

What would be the best way to get the location of java.home in my C++ app? Right now I'm getting it from the registry but am wondering if there's a better/easier/cleaner way.

谢谢,
Serge

Thanks, Serge

推荐答案

如果JAVA_HOME设置为java主目录。如果不是val将为空。

if JAVA_HOME is set to the java home directory. If not val will be null.

char * val = getenv(JAVA_HOME);

这篇关于在C ++中获取java.home的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆