System.loadLibrary() used, improved logging

This commit is contained in:
mrbesen 2020-02-21 10:33:00 +01:00
parent d844699afc
commit d2b861eb7f
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
5 changed files with 4 additions and 10 deletions

View File

@ -5,7 +5,7 @@
#define DEBUG 1
#ifdef DEBUG
#if DEBUG == 1
#define DEB(A) std::cout << A << std::endl
#else
#define DEB(A) ;

View File

@ -19,9 +19,7 @@ fi
make installplugins
#prepare server
mkdir -p testserver/plugins/CppPlugins
cp target/Cppplugin-0.1-SNAPSHOT-final.jar testserver/plugins/
cp target/libplugin.so testserver/plugins/CppPlugins
#start server
cd testserver

View File

@ -76,7 +76,7 @@ void load(JNIEnv* env, long data) {
if(((!CPPPLUGINCLASS) + (!EVENTCLASS) + (!MAPCLASS) + (!LISTENERCLASS) //wenn eins == nullptr ist -> wird zu 1 -> endergebniss != 0 -> fehler
+ (!EVENTDATAF) + (!EVENTNAMEF) + (!PLUGINIDF)
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) == 0) {
+ (!MAPGET) + (!MAPPUT) + (!MAPCLEAR) + (!LISTENERCONTR) + (!LISTENERSMALLCONTR)) != 0) {
DEB("Error loading a information: ");
DEB("find classes: " << (!!CPPPLUGINCLASS) << (!!EVENTCLASS) << (!!MAPCLASS) << (!!LISTENERCLASS));

View File

@ -44,7 +44,7 @@ public class CppLoader implements PluginLoader {
@Override
public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
log.info("try to load: " + file.getName());
log.info("Loading " + file.getName());
return new CppPlugin(file, this);
}

View File

@ -54,12 +54,8 @@ public class CppPlugin implements Plugin {
}
protected boolean init() {
File folder = CppPlugins.getInstance().getDataFolder();
folder.mkdirs();
String path = folder.getAbsolutePath() + "/libplugin.so";
getLogger().info("load library from: " + path);
try {
System.load(path);
System.loadLibrary("plugin"); //loads libplugin.so from System.getProperty("java.library.path")
return init_();
} catch(UnsatisfiedLinkError e) {
e.printStackTrace();