Calling native method from eclipse plugin - eclipse-plugin

I am succeeded to call a c++ library from my JAVA code using JNI.Now I want to load the same. dll from a eclipse plugin and call the library functions.I kept the library in root directory of the plugin folder .
I am getting error like:
Caused by: java.lang.UnsatisfiedLinkError: testproj.testClass.testCall:()V
please help me to resolve that.Why the same code working for Java but not working from plugin?

Got it the package and class name should be same in the plug in and also the dll should be in the same root folder of the .java file where u load the library

Related

java module-info.java with kotlin package

This is all I did:
open IntelliJ community version, create new JavaFX application, select Gradle build and Kotlin language.
just use default package names com.example.demo1
after project created, build
Now it reports error:
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\test\demo1\build\classes\java\main
Caused by: java.lang.module.InvalidModuleDescriptorException: Package com.example.demo1 not found in module
I noticed module-info.java is in java folder but all other source are in kotlin folder. Does that mean java file doesn't know the kotlin package?
If I remove module-info.java, it builds and runs. But module file is required to build artifacts, right?

Calling *.aar files (android library) in nativescript vue

I already create an .aar (android library) files in android studio and want to call/use it in nativescript-vue project.
I have placed the aar file in "app/App_Resources/Android/libs" folder.
Based on my reading, in typescript the way to call the method in aar files is by calling com.package.MyClass.
My question is , how to call it in .vue files. I have tried to call the method using the same approach but its produce an error :
Module not found: Error: Can't resolve com.package.MyClass
Can someone please help me on this.
Your help is very much appreciated.
You may simply place your AAR file in your App_Resources/Android/libs directory, CLI will pick it up at build time and the native APIs should be available at runtime within your project.
Try a clean build if you see errors, make sure the AAR is picked up. You might be able to verify it from the CLI logs. If you still see issues, make sure the class you are trying to access is public.
I'm not sure it's possible to use the android lib directly in the main project or not. In my way, I create a NS plugin that includes the .aar library, then add this plugin to the main project & use the methods defined in the .aar library without problem.
If you place the .aar library in the main project, you should check if that .aar library is installed by running tns build command & look at console log. If it's installed together with the project, that means you can use the lib method in .vue or any .js files.

react native linking a library to inside the another library

Is it possible to link a library which has native dependencies inside another library? Trying to find the solution to link manually, but failing to do it so. I found a [question]: Using React-Native library inside another React-Native library summary, saying It is not possible to add/link a library to another library.
Is there any manual way to do this or not possible?
[Edit]
Trying to add the react-native-spring-scrollview: ^2.0.20 library to my library react-native-demolibrary, which is a library created using react-native-create-library command, since it is a library there were no settings.gradle file. So created and tried to link manually library to react-native-somelibrary.
settings.gradle
include ':react-native-spring-scrollview'
project(':react-native-spring-scrollview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spring-scrollview/android')
build.gradle
implementation project(':react-native-spring-scrollview')
below error has shown up,
GRADLE CONSOLE ERROR
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Build file 'E:\Workspace\DemoApp\node_modules\react-native-demolibrary\android\build.gradle' line: 37
A problem occurred evaluating project ':react-native-library'.
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:139)
at org.gradle.initialization.DefaultGradleLauncher.getConfiguredBuild(DefaultGradleLauncher.java:104)
at .....more
ERROR:
Project with path ':react-native-spring-scrollview' could not be found in project ':react-native-demolibrary'.
Open File
Thank you in advance.

How to load a dll in Karaf container?

I have a dll which provides a simple functionality (called HelloCpp.dll) and
I need to access to the content of this library from Karaf container via REST calls.
I created a simple maven bundle which provides the REST api and a class (HelloJNI) which loads HelloCpp.dll using: System.loadLibrary("HelloCpp");
I have also addressed this dll in my POM file using: <Bundle-NativeCode>HelloCpp.dll</Bundle-NativeCode>
I have coppied the dll in both project directory and also karaf/lib folder.
I can successfuly install the bundle and I don't receive any compilation error as well, but when I deploy my bundle into Karaf container and try to start bundle, I get this error message: No matching native libraries found.
Could you please help me to solve the problem? Maybe I don't address the dll correctly in the POM file.
Thanks in advance,
Mandana

Conversion of jar to dll using ikvm

I am trying to convert a jar into dll in dotnet using IKVM but am getting this error Exception in thread "main" java.lang.ClassNotFoundException: \Location of the jar\...
CAn anyone provide some guidance..
Thanks in advance
Prerequisites -
You must have the JDK installed on your system.
Set the environment variables for the JDK.
Steps:
Open the command prompt.
Go to the ikvmc folder (ikvmc.exe comes with the ikvm package).
Enter the command ikvmc -out:myapp.dll myapp.jar
First, create a new Bindings Library project. In Xamarin Studio or Visual Studio, create a new Solution and select the Android Bindings Library template.
The template includes a Jars folder where you add your .JAR(s) to the Bindings Library project. Right-click the Jars folder and select Add > Existing Item:
Navigate to the .jar file downloaded earlier, select it and click Add:
Verify that the .jar file was successfully added to the project:
right click your jar file=>properities =>choose embedded jar
Set the build action to EmbeddedJar:
EmbeddedJar – the .JAR will be embedded in the Bindings Library.
Set the target API level for your Bindings Library
Finally, build the Bindings Library. Although some warning messages may be displayed, the Bindings Library project should build successfully and produce an output .DLL at the following location:
Projectname/bin/Debug/JarBinding.dll
Reference
https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-a-jar/
Is it possible that you forgot reference all needed IKVM .Net dlls?
IKVM.Runtime.dll
IKVM.Reflection.dll
IKVM.OpenJDK.*.dll
I've got something similar with SmsLib .Net version
The follow wiki pages should be helpful:
http://sourceforge.net/apps/mediawiki/ikvm/index.php?title=ClassLoader
http://sourceforge.net/apps/mediawiki/ikvm/index.php?title=Ikvmc
http://sourceforge.net/apps/mediawiki/ikvm/index.php?title=Ikvmc_messages