Can't link to external libraries from UE4 Project

I am using version 4.9.2 of UE4, and Visual Studio Community 2013. I am trying to get voce speech recognition library ( working in my UE4 project, and having trouble with the linker when I try to build my project. The library uses JNI to call native Java code from C++, which needs the linker to link the “jvm.lib” from my java virtual machine in to the build.

I have it working in a standalone console application in Visual Studio, to get that working I had to add “jvm.lib” into the build by adding to in the “Properties->Linker->Input->Additional Dependencies” in VS, as well as adding the path to the “Properties->Linker->General->Additional Library Directories”. (this is my first attempt to get JNI working, so it took some research to get that far.)

However in the project that was created for me from the UE4 side, I open up the same menu “Project->Properties” that whole menu (Properties->Linker) is just not present.

In UE4 I created this as blank C++ project, then overrode the “Actor” class making a “ListeningActor.cpp” and a “ListeningActor.h”, launched VC++ from UE, then I added the
paths to the include files for voce and java into my “Properties->Configuration Properties->VC++ Directories->General->Include Directories” (which worked insomuch as I was able to get the build to find them)

The build error I am getting is…

error LNK2019: unresolved external symbol __imp__JNI_CreateJavaVM@12 referenced in function "void __cdecl voce::init(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool,bool,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?init@voce@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N100@Z)

that’s the same error I was getting on my console app before I added the “jvm.lib” into my Linker-Additional Dependencies properties entry in CV++.

I need some advice on how to proceed. Is there some way to tell VC++ to show the rest of the project properties panel? Why is it different if I create this project from within UE4?

I solved this problem with loading the jvm.lib first and then take pointer to JNI_CreateJavaVM and managed to make the link work as follow

JNIEnv *env = new JNIEnv();
	JavaVMInitArgs vm_args;

	JavaVMOption* options = new JavaVMOption[1];
	//Path to the java source code     
	options[0].optionString = "-Djava.class.path=D:\\BasicMPGame\\Source\\BasicMPGame\\java\\arabic_reshaper.jar";
	//options[1].optionString = "-verbose";
	//options[2].optionString = "-verbose:jni";
	vm_args.version = JNI_VERSION_1_8; //JDK version. This indicates version 1.8
	vm_args.nOptions = 1;
	vm_args.options = options;
	vm_args.ignoreUnrecognized = JNI_FALSE;

	jint ret = 0;
	// load the jvm.dll
	HINSTANCE hinstLib = LoadLibrary(TEXT("C:\\Program Files\\Java\\jre1.8.0_65\\bin\\server\\jvm.dll"));
	if (!hinstLib)
		// not working cannot load the jvm
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("couldn't load jvm.dll"));
		return  NULL;
		// define the JNI_CreateJavaVM pointer
		typedef jint(JNICALL *PtrCreateJavaVM)(JavaVM **, void **, void *);
		PtrCreateJavaVM ptrCreateJavaVM = (PtrCreateJavaVM)GetProcAddress(hinstLib, "JNI_CreateJavaVM");
		// extra check that everything is good at this point
		if (!ptrCreateJavaVM)
			GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("couldn't create the pointer"));
			return NULL;

		// the actual call to JNI_CreateJavaVM
		ret = ptrCreateJavaVM(&jvm, (void**)&env, &vm_args);

After that ret = JNI_EEXIST which mean that there is jvm already loaded. I have no idea why there is one loaded that don’t contain the classes I want.
I hope this help you. If you know a solution to this please let me know