If anyone should attempt to create a connection to a database using the Java Database Connectivity (JDBC) package in R, that person might encounter something such as the following:
> library(RJDBC) Loading required package: DBI Loading required package: rJava > drv <- JDBC("org.postgresql.Driver","/data/drivers/postgresql-9.4-1201.jdbc41.jar") Error in .jinit(classpath): Unable to create a java class loader
The solution is to quit out and execute the following command from bash:
$ sudo R CMD javareconf
And the error will be resolved! That command simply reconfigures R with the environment variables appropriate to the currently-installed Java packages.