Paulo Cortez
2008-Oct-01  09:54 UTC
[R] Installing RWeka package in CentOS 5: problems with JAVA?
Hi,
I am a R user, with some experience in MacOS, Linux, etc, but I am 
having a problem that I cannot solve:
I have a linux server (CentOS 5) and I installed sun jdk1.6. For instance:
$ java -version
Java version "1.6.0_10-rc2"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc2-b32)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
I also installed the latest version of R:
 > R version 2.7.2 (2008-08-25)
I need to install the package tm, which requires RWeka.
So my first attempt was:
 > 
install.packages("tm",repos="http://cran.cnr.berkeley.edu/",dependencies=TRUE)
Under R. Yet, I got an error related with the RWeka package. Hence, I
downloaded directly the .tgz file and tryed to install it (as root):
$ wget http://cran.cnr.berkeley.edu/src/contrib/RWeka_0.3-14.tar.gz
$ R CMD INSTALL RWeka_0.3-14.tar.gz
* Installing to library '/usr/lib/R/library'
* Installing *source* package 'RWeka' ...
Exception in thread "main" java.lang.NoClassDefFoundError: getsp
Caused by: java.lang.ClassNotFoundException: getsp
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: getsp.  Program will exit.
./configure: line 50: test: -ge: unary operator expected
./configure: line 51: test: -eq: unary operator expected
RWeka needs at least Java version 1.5/5.0.
ERROR: configuration failed for package 'RWeka'
** Removing '/usr/lib/R/library/RWeka'
After surfing the web, I found a japanese/chinese(?) page with the same 
problem and I followed their advice (as I understood):
$ R CMD javareconf
Java interpreter : /usr/java/latest//jre/bin/java
Java version     : 1.6.0_10-rc2
Java home path   : /usr/java/latest/
Java compiler    : /usr/java/latest//bin/javac
Java headers gen.: /usr/java/latest//bin/javah
Java archive tool: /usr/java/latest//bin/jar
Java library path: 
/usr/java/jdk1.6.0_10/jre/lib/i386/server:/usr/java/jdk1.6.0_10/jre/lib/i386:/usr/java/jdk1.6.0_10/jre/../lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib
JNI linker flags : -L/usr/java/jdk1.6.0_10/jre/lib/i386/server 
-L/usr/java/jdk1.6.0_10/jre/lib/i386 
-L/usr/java/jdk1.6.0_10/jre/../lib/i386 -L -L/usr/java/packages/lib/i386 
-L/lib -L/usr/lib -ljvm
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Updating Java configuration in /usr/lib/R
Done.
Then I tryed to repeat the $ R CMD INSTALL RWeka_0.3-14.tar.gz
but I received the previous error. What is wrong? Any help please?
Best regards,
-- 
Paulo Alexandre Ribeiro Cortez  (PhD, MSc)
Lecturer (Prof. Auxiliar) at the Department of Information Systems (DSI)
University of Minho, Campus de Azur?m, 4800-058 Guimaraes, Portugal
http://www.dsi.uminho.pt/~pcortez +351253510313 Fax:+351253510300
Paulo Cortez
2008-Oct-21  14:36 UTC
[R] Installing R in Linux: problems with JAVA packages (rJava, RWeka, ...) ?
Hi, While in MacOS it is quite simple to install R and Java packages, the same is not true for Linux. I surfed the web and it seems that other users also have similar problems. Perhaps a nice FAQ answer or HOWTO would help... But here is my situation: I have 2 linux servers, one with Fedora 9 and the other with CentOS5. I have installed R (2.7.2 version, with yum) and I tryed to install the RWeka and rJava packages. After receiving an error, I installed jdk1.6 from java (file: jdk-6u10-linux-i586-rpm.bin?AuthParam=1224512972_e5a9932e886a02f44dfdfe48aad02db8&TicketId=B%2Fw2nBuFSltLQRRFM1JblgDk&GroupName=CDS&FilePath=%2FESD5%2FJSCDL%2Fjdk%2F6u10%2Fjdk-6u10-linux-i586-rpm.bin&File=jdk-6u10-linux-i586-rpm.bin) in both machines. Then, I had to manually set the java links, using something like: # rm /usr/bin/java # ln -sv /usr/java/default/bin/java /usr/bin/java (repeat these lines for javac, javadoc, javah, etc..) Finally I performed (in both machines): R CMD javareconf (as root) In Fedora9, I opened R and the package installation went well. But in the CentOS5 machine, I received the error: --------- checking Java support in R... configure: error: absent R was configured without Java support. Please run R CMD javareconf as root to add Java support to R. If you don't have root privileges, run R CMD javareconf -e --------- Since the R CMD javareconf did not work, I tryed instead: R CMD javareconf -e And now I receive the error: checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details. Currently, I do not know how to resolve this error. Where is the config.log file? As a root, I did: # find / -name config.log .print and find no file regarding this JNI error. Also, it is quite difficult for a non expert to resolve this type of errors... Any help? Regards, -- Paulo Alexandre Ribeiro Cortez (PhD, MSc) Lecturer (Prof. Auxiliar) at the Department of Information Systems (DSI) University of Minho, Campus de Azur?m, 4800-058 Guimaraes, Portugal http://www.dsi.uminho.pt/~pcortez +351253510313 Fax:+351253510300
Bernardo Rangel Tura
2008-Oct-22  06:51 UTC
[R] Installing R in Linux: problems with JAVA packages (rJava, RWeka, ...) ?
Em Ter, 2008-10-21 ?s 15:36 +0100, Paulo Cortez escreveu:> Hi, > > While in MacOS it is quite simple to install R and Java packages, the > same is not true for Linux. I surfed the web and it seems that other > users also have similar problems. Perhaps a nice FAQ answer or HOWTO > would help... > > But here is my situation: I have 2 linux servers, one with Fedora 9 and > the other with CentOS5. > > I have installed R (2.7.2 version, with yum) and I tryed to install the > RWeka and rJava packages. > > After receiving an error, I installed jdk1.6 from java (file: > jdk-6u10-linux-i586-rpm.bin?AuthParam=1224512972_e5a9932e886a02f44dfdfe48aad02db8&TicketId=B%2Fw2nBuFSltLQRRFM1JblgDk&GroupName=CDS&FilePath=%2FESD5%2FJSCDL%2Fjdk%2F6u10%2Fjdk-6u10-linux-i586-rpm.bin&File=jdk-6u10-linux-i586-rpm.bin) > in both machines.(...) Hi Paulo I think you need install JDK and JRE for using rJava -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
Tru Huynh
2008-Oct-22  09:25 UTC
[R] Installing R in Linux: problems with JAVA packages (rJava, RWeka, ...) ?
On Wed, Oct 22, 2008 at 04:51:13AM -0200, Bernardo Rangel Tura wrote:> Em Ter, 2008-10-21 ?s 15:36 +0100, Paulo Cortez escreveu: > > Hi, > > > > While in MacOS it is quite simple to install R and Java packages, the > > same is not true for Linux. I surfed the web and it seems that other > > users also have similar problems. Perhaps a nice FAQ answer or HOWTO > > would help......> (...) > > Hi Paulo > > I think you need install JDK and JRE for using rJava >http://wiki.centos.org/HowTos/JavaOnCentOS is the recommended way to install java on CentOS see also http://wiki.centos.org/AdditionalResources/Repositories http://wiki.centos.org/PackageManagement/SourceInstalls Tru -- Dr Tru Huynh | http://www.pasteur.fr/recherche/unites/Binfs/ mailto:tru at pasteur.fr | tel/fax +33 1 45 68 87 37/19 Institut Pasteur, 25-28 rue du Docteur Roux, 75724 Paris CEDEX 15 France