I've been trying to load the qdap package, searching on here and troubleshooting, - realised Java couldn't be found. Uninstalled and downloaded Java - assuming I've done the correct 64 bit version as I am assuming I have RStudio 64 by checking
> R.Version()
$platform
[1] "x86_64-w64-mingw32"
I'm using "R version 3.4.3 (2017-11-30)" and Windows 10
Followed the advice here and set the following
Sys.setenv(JAVA_HOME='C:\\Program Files(x86)\\Java\\jre1.8.0_181')
ran this
find.java <- function() {
for (root in c("HLM", "HCU")) for (key in c("Software\\JavaSoft\\Java
Runtime Environment",
"Software\\JavaSoft\\Java
Development Kit")) {
hive <- try(utils::readRegistry(key, root, 2),
silent = TRUE)
if (!inherits(hive, "try-error"))
return(hive)
}
hive
}
Got this
find.java()
> find.java()
$`Security Baseline`
$`Security Baseline`$`1.4.2`
[1] "1.4.2_99"
$`Security Baseline`$`1.5.0`
[1] "1.5.0_99"
$`Security Baseline`$`1.6.0`
[1] "1.6.0_201"
$`Security Baseline`$`1.7.0`
[1] "1.7.0_191"
$`Security Baseline`$`1.8.0`
[1] "1.8.0_181"
Assumed this means Java can now be found. Also did this to check.
> system("java -version")
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) Client VM (build 25.181-b13, mixed mode, sharing)
So try to load rJava again.
> library(rJava)
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object
'C:/Users/grant/OneDrive/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
In addition: Warning message:package ‘rJava’ was built under R version 3.4.4
I've tried to follow the advice given in here and as shown above I know I have Java and a Java Run Time Environment and I have followed some of the suggested fixes already. I haven't done the PATH fixes as I'm not sure what exactly my PATH is, if it's wrong and how to change the PATH or put server in path. I've got as far as this but not sure how to decipher it.
> Sys.getenv("Path")[1] "C:\\Rtools\\bin;C:\\Program Files\\R\\R-3.4.3\\bin\\x64;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Users\\grant\\AppData\\Local\\Microsoft\\WindowsApps;"
I've also tried downloading and using Dependency Walker and didn't understand it.
Have I made an error in my assumptions? Is there an issue with my Path and if so how does Path get changed? Or is there anything else I can try?
Related
I am working with R 4.2.1, 64bit, Windows 10.
while calling library rsubgroup, I get an error:
library(rsubgroup)
Loading required package: foreign
Error: package or namespace load failed for ‘rsubgroup’:
.onLoad failed in loadNamespace() for 'rsubgroup', details:
call: .jinit(parameters = parameters)
error: Unable to create a Java class loader.
rJava loads without problems.
I have installed Java 1.8.0_341 and JDK jdk-18.0.2
I have set-up manually JAVA_HOME and PATH variables.
Any hints what can go wrong with .jinit?
many thanks!
Solved, caused by my comp installation: R is installed in C:.../ProgramFiles that is write-protected (accessible only by "admin"); rJava and rsubgroup installed in the ...Users personal library. While moving all installation (core R, libraries) to writable disk, all starts to work. Apologies for this dumb question but I leave it here - perhaps could help somebody in future...
I'm trying to notarize a DMG via "xcrun altool" in Terminal but it fails with the output below.
In fact it even running iTMSTransporter directly it crashes:
/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/itms/bin/iTMSTransporter
Error: Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
Caused by: java.lang.ClassNotFoundException: 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
What I have done to troublehshoot:
Updated to Xcode 12.3
Updated and installed latest commandline tools for Xcode
Tried two different SDK/JDK/JRE versions of Java, currently using java 15.0.1 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
Tried declaring JAVA_HOME
Looked for iTMSTransporter cache file or folder (in case sensitive and lowercase) in /, ~/ and /Library and ~/Library ~/.itmstransporter in order ot delete it, there is none.
I'm on macOS Big Sur 11.1
I have never had two name versions of Xcode, so I have not had a different name for the app. I tried renaming it for troubleshooting and reverting back to original Xcode name but this also did not help.
Tried reinstalling iTMSTransporter
Error output below:
2020-12-24 10:39:03.442 altool[10776:511525] Sending request to iTunesTransporter…
2020-12-24 10:39:03.442 altool[10776:511525] Command: /usr/local/itms/bin/iTMSTransporter
2020-12-24 10:39:03.442 altool[10776:511525] Arguments: -m upload -u 'XXX' -vp json -DTxHeaders=XXX= -sessionid #env:XXX -sharedsecret #env:XXX -itc_provider '-f' -f '/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/XXX-72174C6DE294/com.XXX.XXX.itmsp' -indicator true -v eXtreme -Dtransporter.client='altool' -Dtransporter.client.version='4.029 (1194)'
2020-12-24 10:39:04.331 altool[10776:511518] Error: Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
2020-12-24 10:39:04.331 altool[10776:511518] Caused by: java.lang.ClassNotFoundException: 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
2020-12-24 10:39:04.336 altool[10776:511525] Error:
Error: Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
Caused by: java.lang.ClassNotFoundException: 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.
2020-12-24 10:39:04.336 altool[10776:511525] Out:
2020-12-24 10:39:04.337 altool[10776:511525] Errors: (
"Error Domain=ITunesTransporterErrorDomain Code=-18000 \"Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.\" UserInfo={NSLocalizedRecoverySuggestion=Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:., NSLocalizedDescription=Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:., NSLocalizedFailureReason=Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.}"
)
2020-12-24 10:39:04.378 altool[10776:511518] *** Error: Unable to notarize app.
2020-12-24 10:39:04.378 altool[10776:511518] *** Error: code -18000 (Could not find or load main class 1.Library.Java.Extensions:.Library.Java.Extensions:.Network.Library.Java.Extensions:.System.Library.Java.Extensions:.usr.lib.java:.)
Issue was fixed after commenting out the line starting with:
JVM_LIB_PATH
in:
/usr/local/itms/bin/iTMSTransporter
It seems the way this line was setting the java related paths to iTMSTransporter was causing it to look in wrong places.
After commenting out this line iTMSTransporter reconfigured itself during launch and notarization submission was successful.
brew install leiningen
I got
Compiling joy.gui.DynaFrame
Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath:
Exception in thread "main" java.io.FileNotFoundException: Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath: , compiling:(/private/var/folders/zm/swyymlvn4l7__d1rln_n391r0000gn/T/form-init7580966196782799989.clj:1:124)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate joy/gui/DynaFrame__init.class or joy/gui/DynaFrame.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$compile$fn__5071.invoke(core.clj:5652)
at clojure.core$compile.invoke(core.clj:5651)
at user$eval20$fn__29.invoke(form-init7580966196782799989.clj:1)
at user$eval20.invoke(form-init7580966196782799989.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 11 more
Compilation failed: Subprocess failed
I tried to reinstall but the issue does not solved.
When I type,
lein version
I got this:
Leiningen 2.9.1 on Java 12 Java HotSpot(TM) 64-Bit Server VM
I installed Java correctly but not sure where to start to fix this problem.
I looked around and it seems you are trying to run an old example from The Joy of Clojure, right?
The example needed a minor touch-up for me to be able to run it.
I created a new Leiningen project first with lein new app dynademo.
Inside the new project folder, I created the directories for the namespace: mkdir -p src/joy/gui
Created the file src/joy/gui/DynaFrame.clj
The Leiningen project that we just created with lein new ... uses Clojure 1.10, which doesn't seem to like one thing:
Replace the line with :prefix df- with :prefix "df-" (eg. wrap the value df- in quotes)
Save the file, and now you can launch the window from the REPL, like this:
$ lein repl
nREPL server started on port 44037 on host 127.0.0.1 - nrepl://127.0.0.1:44037
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
dynaframe.core=> (compile 'joy.gui.DynaFrame)
joy.gui.DynaFrame
dynaframe.core=> (def hello-frame (joy.gui.DynaFrame. "Hello"))
#'dynaframe.core/hello-frame
dynaframe.core=> (.show hello-frame)
nil
It looks like this:
(you will need to move/resize the window a bit, but you get the idea). Note: I'm using Java 8 (JDK 1.8.0_191) but it should work the same in JDK 12.
I try to install the RDRPOSTagger package through devtools.
devtools::install_github("bnosac/RDRPOSTagger", build_vignettes = TRUE)
Downloading GitHub repo bnosac/RDRPOSTagger#master
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\X1\AppData\Local\Temp\RtmpUD2iwv\remotes70c59a944c1\bnosac-RDRPOSTagger-af51e38/DESCRIPTION' ...
- preparing 'RDRPOSTagger': (1.1s)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'RDRPOSTagger_1.1.tar.gz'
Installing package into ‘C:/Users/X1/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'RDRPOSTagger' ...
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'RDRPOSTagger'
finding HTML links ... done
rdr_add_space_around_punctuations html
rdr_available_models html
rdr_model html
rdr_pos html
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'rJava':
.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 'rJava' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/X1/Documents/R/win-library/3.5/RDRPOSTagger'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/X1/AppData/Local/Temp/RtmpUD2iwv/file70c8917649/RDRPOSTagger_1.1.tar.gz’ had non-zero exit status
Session Info:
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Java version on my CPU: java 10.0.2 64 bit
I try to use the qdap package which also needs rJava and this works just fine.
Error : package 'rJava' could not be loaded
This package is not loaded because JAVA_HOME is not set.
It can be done by first installing depending on your R (32 bit or 64 bit), Java 32 bit or 64 bit.
Download java from here: https://www.java.com/en/download/
Using this find JAVA_HOME address:
find.java <- function() {
for (root in c("HLM", "HCU")) for (key in c("Software\\JavaSoft\\Java Runtime Environment",
"Software\\JavaSoft\\Java Development Kit")) {
hive <- try(utils::readRegistry(key, root, 2),
silent = TRUE)
if (!inherits(hive, "try-error"))
return(hive)
}
hive
}
Load find.java and you will find the address for JAVA_HOME. Enter that address here:
Sys.setenv(JAVA_HOME='C:\\Your\\Java\\Directory')
library(rJava)
That should load the package rJava.
ERROR: loading failed for 'i386'
This error is maybe because you have downloaded both version of R (32 bit and 64 bit) and devtools tries to build for both of them.
You can use this:
devtools::install_github("mne-tools/mne-r", INSTALL_opts=c("--no-multiarch"))
I was also getting the similar type of error and after searching through I came across this solutions which worked for me.
I'm trying to use JPL with SWI-Prolog on macOS High Sierra and I'm having troubles. In fact, at first the libjpl.dylib was not found so I added the path to it to java.library.path via
java -Djava.library.path=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/
Now the library is found but I get another error:
java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib, 1): Library not loaded: #executable_path/../swipl/lib/x86_64-darwin15.6.0/libswipl.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
...
From what I understand, this is caused by this version of SWI-Prolog being relocatable (and thus having path relative to the executable).
The output of otool -L of the libjpl.dylib give me this output:
/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib:
#rpath/libjsig.dylib (compatibility version 1.0.0, current version 1.0.0)
#rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
#executable_path/../swipl/lib/x86_64-darwin15.6.0/libswipl.dylib (compatibility version 0.0.0, current version 7.6.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
So one way of fixing it would be to install a not relocatable version via macport or homebrew.
The thing is, neither the MacPorts nor the Homebrew version of SWI-Prolog contains the libjpl.dylib library :/
Am I missing something here? What can I do to make this work?
On macOS 10.13.6 (High Sierra), I regularly compile the SWI-Prolog 7.x sources using:
$ make distclean && ./build && swipl -g "jpl_config_dylib" -t halt
The jpl_config_dylib/0 finds and fixes the Java paths. You should also be able to call it from the top-level after you start the SWI-Prolog.app application.
To whomever this might be useful, as it is not a 100% match to the content of the question asked, but is a 100% match to the title of the question asked.
When installing (at least a recent version of) SWI-Prolog using Homebrew, attempting to use_module(library(jpl)) will result in an error:
ERROR: /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:5428: Initialization goal raised exception:
ERROR: source_sink `jar('jpl.jar')' does not exist
ERROR: In:
ERROR: [48] throw(error(existence_error(source_sink,...),_109418))
ERROR: [44] jpl:add_jpl_to_classpath at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:3979
ERROR: [43] jpl:setup_jvm at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/jpl.pl:4168
ERROR: [42] '$run_init_goal'(jpl:setup_jvm) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:796
ERROR: [41] catch(system:'$run_init_goal'(...),error(existence_error(source_sink,...),context(_109584,_109586)),system:'$initialization_error'(...,...,...)) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:546
ERROR: [40] catch_with_backtrace(system:'$run_init_goal'(...),error(existence_error(source_sink,...),context(_109660,_109662)),system:'$initialization_error'(...,...,...)) at /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/boot/init.pl:614
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
ERROR: Exported procedure jpl:jpl_c_lib_version/1 is not defined
true.
Also, executing the goal jpl_config_dylib results in an error:
?- jpl_config_dylib.
ERROR: Unknown procedure: jpl_config_dylib/0 (DWIM could not correct goal)
The MacPorts version of SWI-Prolog does not have this problem. The solution is to copy the relevant files from under the MacPorts version to under the Homebrew version of SWI Prolog:
$ cp /Applications/SWI-Prolog.app/Contents/swipl/lib/jpl.jar /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/lib/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/lib/x86_64-darwin/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/library/jpl.pl /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/
$ cp /Applications/SWI-Prolog.app/Contents/swipl/library/jpl_config.pl /usr/local/Cellar/swi-prolog/8.4.0/libexec/lib/swipl/library/
After which loading library(jpl) will work fine:
?- use_module(library(jpl)).
true.
?- jpl_new('java.lang.Object', [], JRef).
JRef = <jref>(0x7fbefb086318).