[Subgroup-commits] r68 - in pkg/rsubgroup: R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 15 22:42:08 CET 2020


Author: atzmueller
Date: 2020-03-15 22:42:07 +0100 (Sun, 15 Mar 2020)
New Revision: 68

Modified:
   pkg/rsubgroup/R/AAAonLoad.R
   pkg/rsubgroup/tests/test.R
Log:
move java version check to onload instead of tests

Modified: pkg/rsubgroup/R/AAAonLoad.R
===================================================================
--- pkg/rsubgroup/R/AAAonLoad.R	2020-03-04 13:29:44 UTC (rev 67)
+++ pkg/rsubgroup/R/AAAonLoad.R	2020-03-15 21:42:07 UTC (rev 68)
@@ -23,6 +23,17 @@
 require(rJava)
 
 .onLoad <- function(libname, pkgname) {
-	   rJava::.jpackage(pkgname, lib.loc=libname)
-	   #.jengine(TRUE)
+	# initialize for rJava
+	rJava::.jpackage(pkgname, lib.loc=libname)
+	#.jengine(TRUE)
+	
+		
+	# test Java version
+	.jinit()
+	jv <- .jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
+	if(substr(jv, 1L, 2L) == "1.") {
+		jvn <- as.numeric(paste0(strsplit(jv, "[.]")[[1L]][1:2], collapse = "."))
+		if(jvn < 1.8) stop("Java >= 8 is needed for this package but not available")
+	} 
+
 }

Modified: pkg/rsubgroup/tests/test.R
===================================================================
--- pkg/rsubgroup/tests/test.R	2020-03-04 13:29:44 UTC (rev 67)
+++ pkg/rsubgroup/tests/test.R	2020-03-15 21:42:07 UTC (rev 68)
@@ -19,15 +19,6 @@
 #
 #    Contact: Martin Atzmueller (martin at atzmueller.net)
 ###############################################################################
-library(rJava)
-
-.jinit()
-jv <- .jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
-if(substr(jv, 1L, 1L) == "1") {
-	jvn <- as.numeric(paste0(strsplit(jv, "[.]")[[1L]][1:2], collapse = "."))
-	if(jvn < 1.8) stop("Java 8 is needed for this package but not available")
-} 
-
 library(rsubgroup)
 
 data(credit.data)



More information about the Subgroup-commits mailing list