Sikulix/Python: RuntimeError when trying to load .dll - java

As mentioned in the title im getting a RuntimeError when trying to load a .dll in a sikuli script using ctypes.
import ctypes
path = %path to dll file%
mydll = ctypes.CDLL(path)
The error shows as follows:
[error] script (Test_ctypes) stopped with error in line 6
[error] RuntimeError (path)
[error] ---Traceback--- error source first
line: module (function) statement
262: __init__ (__init__) RuntimeError: path
6: main (<module>) mydll = ctypes.CDLL(path)
[error] ---Traceback --- end ---------------
I've tried the very same code in an anaconda build i have in another pc, and works fine, i can even interact with the functions within the .dll.
My guess would be an installation issue of some sort. As i don't have total control of the pc im running the script in, i'd need to know exactly the cause of the error, if possible...
Thanks in advance.

Related

Cannot get rJava to work properly in MacOS 10.14

I am trying to code using the rSymPy package. When I type in library(rSymPy) I get the following warnings:
> library(rSymPy)
Loading required package: rJython
Loading required package: rJava
Loading required package: rjson
Warning messages:
1: package ‘rJava’ was built under R version 3.4.4
2: package ‘rjson’ was built under R version 3.4.4
This is fine because in theory my code should still work. However, when I try running my function which uses the sympy() command I get the following error:
> moment_generating_function(12)
Show Traceback
Error in .jcheck() : No running JVM detected. Maybe .jinit() would help.
I then run .jinit() which produces no output. Running my code again, I now get the following error
Error in .jcall("RJavaTools", "Z", "hasField", .jcast(x, "java/lang/Object"), :
java.lang.NullPointerException
I have tried reinstalling my JDK and tried running "r cmd javareconf;" in my terminal multiple times. I would just code this directly in Python but unfortunately my assignment requires I use the rSymPy package in R. I would greatly appreciate any help with this.

Cannot get gomobile binding to work with java

Go version: 1.7.5
GOPATH = D:/GoWork
React Native version 0.41
Code below is the binding go package at D:\GoWork\src\rngo\rngo\rngo.go
Very simple, just returning a string
package rngo
// RNcall is used to bind with RN
func RNcall() string {
return "From Go platform"
}
Running the below command from > D:\GoWork\src\rngo
gomobile bind -target android -o rngo.aar -v .
Verbose Output below seems to be fine
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\classes.go
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\classes.h
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\classes.c
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gen\src\Java\interfaces.go
rngo/rngo
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\fakegopath\pkg\android_arm\rngo\rngo.a
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\go_rngomain.go
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\go_main.go
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\androidlib\main.go
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\android\src\main\java\rngo\Rngo.java
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\java_rngo.c
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\rngo.h
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\android\src\main\java\go\Universe.java
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\android\src\main\java\go\error.java
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\java_universe.c
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\universe.h
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\seq_android.go
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\seq_android.c
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\seq.h
write C:\Users\Minty\AppData\Local\Temp\gomobile-work-855641675\gomobile_bind\seq.go
Java
/C/Users/Minty/AppData/Local/Temp/gomobile-work-855641675/gomobile_bind command-line-arguments rngo/rngo Java
/C/Users/Minty/AppData/Local/Temp/gomobile-work-855641675/gomobile_bind command-line-arguments rngo/rngo Java
/C/Users/Minty/AppData/Local/Temp/gomobile-work-855641675/gomobile_bind command-line-arguments rngo/rngo Java
/C/Users/Minty/AppData/Local/Temp/gomobile-work-855641675/gomobile_bind
/# /C/Users/Minty/AppData/Local/Temp/gomobile-work-855641675/gomobile_bind
D:\Android\sdk\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld:
warning: skipping incompatible
D:\Android\sdk\ndk-bundle\platforms\android-21\arch-x86_64/usr/lib/liblog.so
while searching for log
D:\Android\sdk\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld:
warning: skipping incompatible
D:\Android\sdk\ndk-bundle\platforms\android-21\arch-x86_64/usr/lib/libdl.so
while searching for dl
D:\Android\sdk\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld:
warning: skipping incompatible
D:\Android\sdk\ndk-bundle\platforms\android-21\arch-x86_64/usr/lib/libc.so
while searching for c
D:\Android\sdk\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld:
warning: skipping incompatible
D:\Android\sdk\ndk-bundle\platforms\android-21\arch-x86_64/usr/lib/libdl.so
while searching for dl
command-line-arguments
aar: AndroidManifest.xml
aar: proguard.txt
aar: classes.jar
jar: META-INF/MANIFEST.MF
jar: go/LoadJNI.class
jar: go/Seq$GoObject.class
jar: go/Seq$Proxy.class
jar: go/Seq$Ref.class
jar: go/Seq$RefMap.class
jar: go/Seq$RefTracker.class
jar: go/Seq.class jar: go/Universe$proxyerror.class jar:
go/Universe.class
jar: go/error.class
jar: rngo/Rngo.class
aar: jni/armeabi-v7a/libgojni.so
aar: jni/arm64-v8a/libgojni.so
aar: jni/x86/libgojni.so
aar: jni/x86_64/libgojni.so
aar: R.txt
aar: res/
Successfully created rngo.aar since there is no error message and I can see that file at D:\GoWork\src\rngo\rngo.aar
I then manually import rngo.aar file into React Native project from android studio
File > New > New Module > Import .aar/.jar Package > #give the path
to rngo.aar#
File > Project Structure > app > Dependencies >
Module dependency > rngo.aar
Inside IDE, in MainActivity.java I can successfully do 'import go.rngo.*;', but I cannot get 'go.rngo.Rngo.RNcall()' or 'go.rngo.Rngo;' to work
Building this android app throws error 'cannot find symbol'
D:\RN\gomobile\android\app\src\main\java\com\gomobile\RngoModule.java:10:
error: cannot find symbol
import go.rngo;
^
symbol: class rngo
location: package go
1 error
:app:compileDebugJavaWithJavac FAILED
Conclusion
I am doing something horribly wrong, that I cannot get this simple thing to work. I wasted whole day on google but with no avail. Hence I need help getting this to work. All I need is a simple go code with that connects to react native hasselfree.
Thanks for reading all this. I appreciate it.
Thanks to eliasnaur. Finally, I got this working. As of go 1.7.* you dont have access to go package. Instead access your package directly like this
Before:
import go.rngo.Rngo;
After:(Since 1.7.*)
import rngo.Rngo;

R on Windows 10, rcmdr 'hasjava' error

I am trying to run biodiversity r in r studio with the biodiversity rgui which links up to the rcmdr. I have tried every help forum to find an answer but come up with nothing. I reinstalled R, R studio, updated all packages, installed rjava and javagd and still it refuses to work. I am at wits end!!! I cannot find anything about 'hasjava' and I have updated and installed java already.
Below is copy pasted from the console.
Restarting R session...
> library("BiodiversityR", lib.loc="~/R/win-library/3.2")
Loading required package: tcltk
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.3-0
BiodiversityR 2.5-3: use function 'BiodiversityRGUI()' to launch the BiodiversityR Graphical User Interface
> library("rJava", lib.loc="~/R/win-library/3.2")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error: package or namespace load failed for ‘rJava’
> BiodiversityRGUI()
Sourced: BiodiversityGUI.R
Error : .onAttach failed in attachNamespace() for 'Rcmdr', details:
call: eval(expr, envir, enclos)
error: could not find function "hasJava"
Error: package or namespace load failed for 'Rcmdr'
This problem has nothing directly to do with Windows or with Java.
The Rcmdr package no longer uses Java, and the function hasJava(), which was defined in and exported by the Rcmdr, no longer exists. Apparently BioDiversityR uses this function and needs to be updated appropriately.
You might report your problem directly to the maintainer of BioDiversityR.
I hope this help,
John

Can't build cordova projects

I have a problem with setting up the work environment for Cordova on Windows 7 for Android. I use NetBeans 8 and followed this guide: Link Here
New project -> Cordova -> Hello World Template.
Whenever I try to build a Cordova project (in NetBeans) I get this message:
BUILD FAILED
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml:90: Cannot find C:\Users\Administrator\SkyDrive\Skolegang\Dataingeniør\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml
Total time: 0 seconds
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\node_modules\q\q.js:126
throw e;
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Command finished with error code 8: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat --emulator
C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\nbproject\build.xml:272: exec returned: 1
BUILD FAILED (total time: 47 seconds)
I have googled it for hours but can't seem to find a solution. Some people get some of the same errors(not exact, but similar), but the solutions did not work for me. One issue was regarding Java 8 and ant versions beneath 1.9.0 (I use Node 0.10.26, java 1.7.0_25, cordova 3.5.0-0.2.4 and ant 1.9.4). I also tried to create a new project with the console (CMD), but it gives the exact same error when I build. It's no problem to create the project, nor adding Android as a platform, the problem is building the project. I think the environment variables are set correctly since the java, node, ant and cordova commands work fine in cmd/powershell, and the check_reqs.bat said that the environment was fine.
It's this line that creates the error: <import file="${sdk.dir}/tools/ant/build.xml" />. This is the rest of the message: Cannot find C:\Users\Administrator\SkyDrive\Skolegang\Dataingeniør\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml.
Here is the error I get in the command window (not using NetBeans):
PS C:\Users\Administrator\Desktop\test\fakeApp> cordova build android
Running command: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\cordova\build.bat
Buildfile: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\build.xml
BUILD FAILED
C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\build.xml:90: Cannot find C:\Users\Administrator\SkyDrive\
Skolegang\Dataingeni├©r\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Admini
strator\Desktop\test\fakeApp\platforms\android\build.xml
Total time: 0 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Administrator\Desktop\test\fakeApp\platforms\androi
d\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: C:\Users\Administrator\Desktop\test\fakeApp\platforms\android\cordova\build.bat: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\s
rc\cordova\superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I thought maybe it was a path issue since I have a special letter in the path were the NetBeansProjects are stored (and it's pretty long too), but creating a test directory at C:\ and creating the project with the command window gave the same error. I'm new at Cordova so I'm sure there's an easy solution, thanks in advance.
I solved it, though I tried to create a cordova project outside the OneDrive folder I did not think of the SDK path (which also were stored in OneDrive). By moving the SDK files to C: (the path could probably not contain the special letter 'ø') and changing the path of the environment variables (and the SDK path in NetBeans) it now runs perfectly.

cannot find org.neo4j.batchimport

I am continuing to have trouble with the import.bat file for the Neo4j batch importer. I started a new thread as the original problem was resolved.
from the command prompt I run
import.bat test.db sample\nodes.csv sample\rels.csv
With some variations on the path listing for the files, including absolute paths. I continue to get the following error message
The system cannot find the path specified.
Error: Could not find or load main class org.neo4j.batchimport.Importer
I also tried running import.sh from Cygwin and in my Debian VM but keep getting the error
Error: Could not find or load main class org.neo4j.batchimport.Importer
What am I doing wrong?
Please download the zip-file, not the github clone.
This is a pre-build binary as outlined in the readme, that doesn't require that you have to have maven installed to build it.

Categories

Resources