[R] Including Java files in R Package

Duncan Murdoch murdoch at stats.uwo.ca
Wed Apr 16 01:26:48 CEST 2008


On 15/04/2008 7:20 PM, Hongshu Chen wrote:
> Hi,
> 
> I am building a package which contains some Java class files. I am planning
> to create a subdirectory "inst/Java/" in the source directory and put Java
> files in it, therefore after installing the package, those files will be in
> the "Java/" subdirectory in where the package is installed. My question is,
> how can I make references to those Java files in the R source files in my
> package? Or is there a better way to do this?

I assume you just want to know how to find them, you already know how to 
use them once you've found them.

The path to the Java/ subdir is given by

system.file("Java", package="yourPackage")

and so the file my.class is in

file.path(system.file("Java", package="yourPackage"), "my.class")

Duncan Murdoch



More information about the R-help mailing list