Re: [R] Including Java files in R Package

From: Duncan Murdoch <>
Date: Tue, 15 Apr 2008 19:26:48 -0400

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Apr 2008 - 00:30:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 07:30:33 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive