Learn R Programming

The J4R package

The J4R package is licensed under the GNU General Public License v3.0 (GPL-3).

The J4R package makes it possible to execute native Java code in an R environment. More specifically, it allows to create Java objects and to invoke Java methods, whether they are static or not. The package is based on a local Java server that is instantiated through a Java library packaged as j4r.jar. This Java library is licensed under the Lesser GNU General Public License v3.0 (LGPL-3). Both the J4R package and the j4r Java library come with absolutely NO WARRANTY.

The source code of the J4R package and the j4r library is freely available at https://svn.code.sf.net/p/repiceasource/code/trunk .

The documentation can be found at https://sourceforge.net/p/repiceasource/wiki/J4R/ .

Tickets can be created at https://sourceforge.net/p/repiceasource/tickets/ .

Mathieu Fortin e-mail: mathieu.fortin.re@gmail.com

Copy Link

Version

Install

install.packages('J4R')

Monthly Downloads

23

Version

1.0.8

License

GPL-3

Maintainer

Mathieu Fortin

Last Published

July 23rd, 2020

Functions in J4R (1.0.8)

as.long

Cast the object into a Java long type
getArrayLength

Return the length of an Array instance
getListOfJavaReferences

Provide a list of the Java references
setJavaField

Set the value of a public field
setJavaPath

Set the path to Java
getMemorySettings

Returns the maximum, total and free memory in Mb
getClassLoaderURLs

Retrieve the URLs of the current classloader
j4r.config.setVerbose

Enabling/disabling Verbose
getJavaArchitecture

Get Java architecture
is.JavaArray

Check if the java.object instance represents an Array
getClassLoaderPaths

Retrieve the paths of the current classloader
callJavaGC

Synchronize the Java environment with the R environment
connectToJava

Connect to Java environment
isConnectedToJava

Checks if the Java server is running
createJavaObject

Create Java objects
maxVectorLength

Maximum length of the vector in the parameters.
getAllValuesFromListObject

Returns all the elements of a Java instance of List
getAllValuesFromArray

Returns all the elements of a Java array
getJavaField

Get the value of a public field
mclapply.j4r

Using multithreading with J4R
setValueInArray

Set a value in an array
settingEnv

The settings environment for this package
killJava

Force the JVM to shut down
getValueFromArray

Get a value from an array
getJavaVersion

Get the current Java version
print.java.list

Print a java.list object
isJavaArray

Check if the java.object instance represents an Array
j4r.config.setDefaultJVMMemorySize

Set a default memory size for the Java Virtual Machine
interruptJava

Interrupt the current task on the Java server
length.java.list

Override the default length function
length.java.object

Override the default length function
getNbConnections

The number of connections to the server
print.java.object

Print a java.object instance
getNbInstancesInInternalMap

Return the number of instances stored in the internal map of the Java server
shutdownJava

Shut down Java
as.JavaArray

Create a Java array from an R array
cacheEnv

The cache environment of this package
as.float

Cast the object into a Java float type
addToClassPath

Dynamically adds a path or a jar file to the classpath.
callJavaMethod

Call a Java method
addUrlToClassPath

Dynamically adds an url to the classpath.
bufferLength

Length of the buffer when reading from the socket connection.
checkIfClasspathContains

Check if a Library has been loaded