프로그래밍

[JAVA] 20. Library - JRI

Grab Java 2024. 6. 7. 15:31

Linux-R-rJava-JRI-qValue setting


R installation

. download : http://ftp5.gwdg.de/pub/misc/cran/src/base/R-2/R-2.10.0.tar.gz
. unzip
. ./configure --enable-R-shlib --with-x=no
    에러 : --with-readline=yes ~ not available
    처리 : apt-get install libreadline-dev
. make
. make check
. make install
. /etc/profile
    JAVA_HOME
    R_HOME (/usr/local/lib64/R)

 


 rJAVA installation

. download : http://www.rforge.net/rJava/snapshot/rJava_0.8-2.tar.gz
. unzip
. ./configure
    에러 : JDK is missing or not registered in R
    처리 : R CMD javareconf -e
    에러 : error: One or more JNI types differ from the corresponding native type.
    처리 : R CMD javareconf -e
. R 실행
    install.packages('rJava')
    system.file("jri",package="rJava")
. /etc/profile
    CLASSPATH ($R_HOME/library/rJava/jri/examples)
. /usr/local/lib64/R/etc/ldpaths
    LD_LIBRARY_PATH
        /usr/local/lib64/R/lib
        /usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/amd64/server
. ./run rtest



qValue installation

. Download : http://www.genomics.princeton.edu/storeylab/qvalue/qvalue_1.1.tar.gz
. R CMD INSTALL qvalue_1.1.tar.gz
. R 실행
library(qvalue)
a = c(0.387, 0.582, 0.21, 0.013, 0.809, 0.01, 0.863, 0.788, 0.263, 0.284, 0.479, 0.057, 0.391, 0.869, 0.03, 0.768, 0.619, 0.059, 0.673, 0.187, 0.119, 0.828, 0.468, 0.418, 0.405, 0.723, 0.193, 0.002, 0.265, 0.061, 0.64, 0.657, 0.983, 0.632, 0.09)
b<-as.matrix(a)
q<-qvalue(b, lambda=0)
qval<-q$qvalues
qval



Tomcat control (bl07)

. source /etc/profile
. source /usr/local/lib64/R/etc/ldpaths
. /home/tomcat/bin/startup.sh
. ps -ef | grep tomcat
. Java Project 다시 올리기

Windows-R-rJava-JRI setting


R installation

. download : http://www.r-project.org/ > http://bibs.snu.ac.kr/R/
. install path : C:\R (Program files 아래에 설치하면 경로 error 발생)
. ref site : http://www.rforge.net/JRI/ 

 


R configuration

. R 실행
. install.packages("rJava")
. system.file("jri",package="rJava")  => 이때 output의 path가 명확해야 한다.

 


환경변수 설정

. R_HOME 등록 : C:\R
. Path 추가 : C:\R\bin;C:\R\library\rJava\jri;


 
Netbeans jar setting

. netbeans 실행 > Projects Wnd의 Libraries r클릭 > jar 추가



Example

. path : C:\R\library\rJava\jri\examples
. project 생성 > rtest 클래스 생성 > path의 rtest 코드 copy paste.
. clean build > run..



java.library.path 에러 발생 시

. jri.dll 파일을 Java jdk 설치 경로의 bin 디렉토리에 복사