Ken Williams
Ken Williams

Reputation: 23955

How to compile R package that uses rJava

I have rJava successfully installed, and I'm trying to compile a package that uses some Java code - in this case the RHive package.

If I'm in RStudio and I do "Clean & Rebuild" or "Build & Reload", the Java code never seems to get compiled. I see this in the console:

==> R CMD INSTALL --no-multiarch --with-keep.source RHive

* installing to library ‘/home/kwilliams/R-dev’
* installing *source* package ‘RHive’ ...
** package ‘RHive’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RHive)

but if I make changes to the Java code - syntax errors even - it doesn't seem to have any effect. So clearly my configuration is wrong somewhere.

What am I supposed to do in a project's setup to tell it there's Java code that needs to get compiled? Is there anything RStudio-specific I'll need to do too?

Upvotes: 1

Views: 637

Answers (1)

Ken Williams
Ken Williams

Reputation: 23955

Over on github, Simon clarified that the package author needs to take care of compilation separately and that there's no provision in the R build process to compile Java code.

If I can get back to this issue (at work) I might try to submit a doc patch that makes it clear that the java has to be compiled manually, and how one might go about it.

Upvotes: 1

Related Questions