ui: autodetect java on windows

* implemented a more generic approach to detecting filepaths
* reimplemented standard header detection using this approach
* added auto detection of JVM dynamic library on windows
* fixed java tests that were broken when updating the java_indexer project before this commit.
This commit is contained in:
malte_langkabel
2016-08-24 15:21:04 +02:00
parent 01f740276b
commit 8dfc1ea9d9
30 changed files with 508 additions and 370 deletions
@@ -37,7 +37,7 @@ void JavaEnvironmentFactory::createInstance(std::string classPath)
{
std::string oldPathContent = getenv("path");
std::string javapath = ApplicationSettings::getInstance()->getJavaPath() + "/client/";
std::string javapath = ApplicationSettings::getInstance()->getJavaPath() + "/";
putenv(("path=" + oldPathContent + ";" + javapath).c_str()); // path env is only modified in the scope of this process.
javaFound = FileSystem::exists(javapath + "jvm.dll");
@@ -88,7 +88,7 @@ void JavaEnvironmentFactory::createInstance(std::string classPath)
JavaVMOption* options = new JavaVMOption[3]; // JVM invocation options
std::string classPathOption = "-Djava.class.path=" + classPath;
options[0].optionString = const_cast<char*>(classPathOption.c_str());
options[1].optionString = const_cast<char*>("-Xms1m");
options[1].optionString = const_cast<char*>("-Xms64m");
std::string maximumMemoryOprionString = "-Xmx" + std::to_string(ApplicationSettings::getInstance()->getJavaMaximumMemory()) + "m";
options[2].optionString = const_cast<char*>(maximumMemoryOprionString.c_str());
vm_args.version = JNI_VERSION_1_6;