Possible bug in extract_tables()
Hello, I experience a possible bug on MacOS BigSur with java jdk 16 in the function extract_tables(). I wasn't able to extract tables from files, which I was able to open on Linux. But for instance extract_text() works.
Error message:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not "opens java.util" to unnamed module @1139b2f3
Traceback:
6: stop(structure(list(message = "java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not \"opens java.util\" to unnamed module @1139b2f3",
call = .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod",
cl, .jcast(if (inherits(o, "jobjRef") || inherits(o,
"jarrayRef")) o else cl, "java/lang/Object"), .jnew("java/lang/String",
method), j_p, j_pc, use.true.class = TRUE, evalString = simplify,
evalArray = FALSE), jobj = new("jobjRef", jobj = <pointer: 0x7ff6e5e1a0c0>,
jclass = "java/lang/reflect/InaccessibleObjectException")), class = c("InaccessibleObjectException",
"RuntimeException", "Exception", "Throwable", "Object", "error",
"condition")))
5: .jcheck(silent = FALSE)
4: .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,
.jcast(if (inherits(o, "jobjRef") || inherits(o, "jarrayRef")) o else cl,
"java/lang/Object"), .jnew("java/lang/String", method),
j_p, j_pc, use.true.class = TRUE, evalString = simplify,
evalArray = FALSE)
3: .jrcall(x, name, ...)
2: guessesIterator$hasNext()
1: tabulizer::extract_tables(pdf)
sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tabulizer_0.2.2
loaded via a namespace (and not attached):
[1] tabulizerjars_1.0.1 httr_1.4.2 compiler_4.0.4 magrittr_2.0.1 R6_2.5.0 tools_4.0.4 curl_4.3 yaml_2.2.1
[9] xml2_1.3.2 rvest_1.0.0 lifecycle_1.0.0 rlang_0.4.10 rJava_0.9-13 png_0.1-7
I'm having the same issue.
I am having the same issue but on a windows. The other tabulizer functions work fine but extract_table throws an error when using the sample code:
library("tabulizer")
f <- system.file("examples", "data.pdf", package = "tabulizer")
tab <- extract_tables(f, pages = 1)
The error is: Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not "opens java.util" to unnamed module @327514f
I'm having the same issue with extract_tables. Here is the output. Does someone has an answer? Thanks in advance.
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not "opens java.util" to unnamed module @a530d0a
Exact same issue here! Running 64bit R, JRE 1.8.0_291 and JDK 16.0.1 on Windows. New to tabulizer, would love to get it working, but likewise extract_table throws the identical error posted by @kzarada @ivoggv, etc. extract_text works. For what it's worth this StackExchange answer seems to refer to this problem pretty clearly, but I don't know enough (Read: anything) about Java so don't know what to do with the answer.
I have this issue too! Running jdk-16.0.2, R 4.0.5.
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not "opens java.util" to unnamed module @41e36e46
>sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tabulizer_0.2.2
loaded via a namespace (and not attached):
[1] tabulizerjars_1.0.1 compiler_4.0.4 tools_4.0.4 rJava_1.0-4 png_0.1-7
Same here.
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.ArrayList$Itr.hasNext() accessible: module java.base does not "opens java.util" to unnamed module @4ba534b0
> sessionInfo()
R version 4.1.1 Patched (2021-09-01 r80852)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.5.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tabulizer_0.2.2 data.table_1.14.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 magrittr_2.0.1 xtable_1.8-4 R6_2.5.1 rlang_0.4.11
[6] fastmap_1.1.0 stringr_1.4.0 tools_4.1.1 shiny.i18n_0.2.0 png_0.1-7
[11] htmltools_0.5.2 ellipsis_0.3.2 yaml_2.2.1 digest_0.6.27 lifecycle_1.0.0
[16] rJava_1.0-4 shiny_1.6.0 later_1.3.0 promises_1.2.0.1 glue_1.4.2
[21] mime_0.11 stringi_1.7.4 compiler_4.1.1 tabulizerjars_1.0.1 jsonlite_1.7.2
[26] httpuv_1.6.2
~ java --version
openjdk 17 2021-09-14
OpenJDK Runtime Environment Homebrew (build 17+0)
OpenJDK 64-Bit Server VM Homebrew (build 17+0, mixed mode)
~ javac -version
javac 17
Thanks for the relate thread which is provided by @matthewstern, I found a way how to avoid this error, just downgrade your jdk to 1.8, which is JAVA8 not JAVA 9 or later.
And here is my new session info and Java version:
~ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
~ javac -version
javac 1.8.0_292