Save java file and compile.
Install rJava library. Add the following lines in code to bind class file.
library(rJava)
.jinit()
.jaddClassPath(<class file path>)
.jclassPath()
......