Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Egon Willighagen
On Sunday 22 October 2006 18:02, Simon Urbanek wrote:
> The bad news is that JGR doesn't quite
> work. Although I was able to start JGR with GIJ, its Swing
> implementation seems to be incomplete/incompatible such that I get
> tons of exceptions on the console that fail in the middle of the GIJ
> Swing implementation code (somewhere in the event dispatch with a
> failed assertion).

OK, please do file the exceptions you get in the Classpath bug tracker at:

http://www.gnu.org/software/classpath/bugs.html

They generally appreciate this very much, but it would help if you explain how 
they can reproduce the problem yourself.

BTW, I'll try to reproduce your tutorial next weekend.

Egon

-- 
[EMAIL PROTECTED]
Cologne University Bioinformatics Center (CUBIC)
Blog: http://chem-bla-ics.blogspot.com/
GPG: 1024D/D6336BA6


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Simon Urbanek

On Oct 20, 2006, at 11:13 AM, Egon Willighagen wrote:


cc: debian-java -> I need a bit of help here, see below

[...]
I've found out that it now actually is a package on CRAN, and  
installs fine, and really just depends on rJava for the Java  
binding. (JGR and rJava are downloaded as source tar.gz from [1]).




Thanks for the hints as of how to get it running with GIJ. I'm the  
maintainer of rJava, so I do appreciate being CC'ed in such matters ;).




I had a brief go at installing rJava against GIJ:

$ JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0 R CMD
INSTALL --library=/usr/local/lib/R/site-library rJava_0.4-11.tar.gz



I was able to install it using the "regular" package installation:

sudo R
> install.packages("rJava")

Specifying JAVA_HOME should not be necessary as long as "java" is on  
the PATH.




(R comes with the package r-base).

You need to have java-gcj-compat-dev and libgcj-bc installed.

But it fails because of this call:

/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -target 1.4 -source
1.4 -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples
examples/rtest.java

Note the duplicate '-target 1.4 -source 1.4', which is OK for the  
Sun javac,

but breaks compiling with gcj 4.1 javac.



Ok, thanks, I'll fix that for the next JRI/rJava release (in fact it  
will be fixed in tonight's nightly build).




However, running it still fails with this error:
$ R


and then on the R command line:
> library(rJava)

which fails with:

Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared
library '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory
Error in library(rJava) : .First.lib failed for 'rJava'

Not sure what else I can/should try now. Ideas?



Your R is apparently configured without Java support. If you have R  
2.4.0, run

sudo R CMD javareconf
and everything should be fine. If you have R 2.3.1 (earlier versions  
won't work at all), then you have to edit

/usr/lib/R/etc/ldpaths
and replace the first line
: ${R_JAVA_LD_LIBRARY_PATH=}
with
: ${R_JAVA_LD_LIBRARY_PATH=/usr/lib/gcj-4.1:/usr/lib/jni}

This will make rJava work (at least it did on my Debian system). The  
good news is that iplots appear to work nicely (that's a good test as  
iplots are not quite trivial). The bad news is that JGR doesn't quite  
work. Although I was able to start JGR with GIJ, its Swing  
implementation seems to be incomplete/incompatible such that I get  
tons of exceptions on the console that fail in the middle of the GIJ  
Swing implementation code (somewhere in the event dispatch with a  
failed assertion).


Therefore for JGR I can only recommend using Sun's Java (or IBM or  
Blackdown ...) for now which is easy to install on Debian via make- 
jpkg (obtainable via apt-get install java-package). If someone can  
look into the Swing problems in GIJ, please do so, I'd be delighted  
if we had a version running against free Java, but we don't have the  
resources here to dig deep into that.


Thanks,
Simon

PS: For those not familiar with R that want to give it a shot, JGR  
can be installed by typing in R (as root):

install.packages("JGR",dep=T)
and start JGR with
library(JGR)
JGR()
the latter will create a start shell script that can be used  
consequently (it shows you where to find it).


PPS: It is not necessary to re-compile rJava even when switching Java  
implementations (i.e. you can compile rJava against Sun's Java and  
use it with GIJ or vice-versa), in R 2.4.0 you can simply change the  
"java" on PATH or set different JAVA_HOME and run "R CMD javareconf"  
- that's all.



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Egon Willighagen
On Sunday 22 October 2006 13:11, Andrew Haley wrote:
>  > diff -ru rJava-orig/src/Makevars.in rJava/src/Makevars.in
>  > --- rJava-orig/src/Makevars.in  2006-10-11 01:52:30.0 +0200
>  > +++ rJava/src/Makevars.in   2006-10-22 12:39:36.0 +0200
>  > @@ -14,5 +14,5 @@
>  >  jri:
>  > $(MAKE) -C ../jri/
>  > [EMAIL PROTECTED] -p ../inst/jri
>  > -
>  > @(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/run ../jri/examples
>  > ../inst/jri/) +
>  > @(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/examples ../jri/run
>  > ../inst/jri/)
>
> This looks like a change without a difference.

:)

I reverted that one, since removing the $(JFLAGS) made the examples 
compilable, but put the example dir at the wrong position :)

Egon

-- 
[EMAIL PROTECTED]
Cologne University Bioinformatics Center (CUBIC)
Blog: http://chem-bla-ics.blogspot.com/
GPG: 1024D/D6336BA6


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Andrew Haley
Egon Willighagen writes:
 > 
 > On Sunday 22 October 2006 11:51, Andrew Haley wrote:
 > >  > But it fails because of this call:
 > >  >
 > >  > /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -target 1.4 -source
 > >  > 1.4 -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples
 > >  > examples/rtest.java
 > >  >
 > >  > Note the duplicate '-target 1.4 -source 1.4', which is OK for the Sun
 > >  > javac, but breaks compiling with gcj 4.1 javac.
 > >
 > > What is javac here? 
 > 
 > See code above:
 > 
 > /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac
 > 
 > with:
 > 
 > $ ls -la /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac
 > lrwxrwxrwx 1 root root 12 2006-10-20 
 > 17:04 /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -> /usr/bin/ecj
 > 
 > 
 > 
 > > If it's a link to ecj, which it should be, this will work.
 > 
 > How?
 > 
 > $ /usr/bin/ecj -target 1.4 -source 1.4 -target 1.4 -source 1.4 -classpath 
 > src/JRI.jar -d examples examples/rtest.java
 > 
 > Gives:
 > 
 > duplicate target compliance setting specification: 1.4
 > 
 > where:
 > 
 > $ /usr/bin/ecj -version
 > Eclipse Java Compiler v_677_R32x, 3.2.1 release, Copyright IBM Corp 2000, 
 > 2006. All rights reserved.
 > 
 > Actually, instead of commenting out that line in Makefile.all, you can also 
 > just remove the $(JFLAGS) to get:
 > 
 > examples/%.class: examples/%.java src/JRI.jar
 > $(JAVAC) -classpath src/JRI.jar -d examples $<
 > 
 > The first "-target 1.4 -source 1.4" is part of the $(JAVAC) var.

Oh, I see.  Fair enough.

 > >  > which fails with:
 > >  >
 > >  > Error in dyn.load(x, as.logical(local), as.logical(now)) :
 > >  > unable to load shared
 > >  > library '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
 > >  >   libjvm.so: cannot open shared object file: No such file or directory
 > >  > Error in library(rJava) : .First.lib failed for 'rJava'
 > >  >
 > >  > Not sure what else I can/should try now. Ideas?
 > >
 > > Did you install rJava.so? 
 > 
 > Yes, using the R CMD INSTALL call in my first email.
 > 
 > > If so, where is it? 
 > 
 > See the above error message:
 > 
 > /usr/local/lib/R/site-library/rJava/libs/rJava.so
 > 
 > $ ls -al /usr/local/lib/R/site-library/rJava/libs/rJava.so
 > -rwxr-xr-x 1 egonw staff 128075 2006-10-22 
 > 12:37 /usr/local/lib/R/site-library/rJava/libs/rJava.so

Interesting.  So, the file is where it is expected to be, but gij
still reports that the file is missing.  How very odd.

I can't explain that.  Setting LD_DEBUG=all before running the program
might tell you something.

 > diff -ru rJava-orig/src/Makevars.in rJava/src/Makevars.in
 > --- rJava-orig/src/Makevars.in  2006-10-11 01:52:30.0 +0200
 > +++ rJava/src/Makevars.in   2006-10-22 12:39:36.0 +0200
 > @@ -14,5 +14,5 @@
 >  jri:
 > $(MAKE) -C ../jri/
 > [EMAIL PROTECTED] -p ../inst/jri
 > -   
 > @(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/run ../jri/examples 
 > ../inst/jri/)
 > +   
 > @(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/examples ../jri/run 
 > ../inst/jri/)

This looks like a change without a difference.

Andrew.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Egon Willighagen

On Sunday 22 October 2006 11:51, Andrew Haley wrote:
>  > But it fails because of this call:
>  >
>  > /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -target 1.4 -source
>  > 1.4 -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples
>  > examples/rtest.java
>  >
>  > Note the duplicate '-target 1.4 -source 1.4', which is OK for the Sun
>  > javac, but breaks compiling with gcj 4.1 javac.
>
> What is javac here? 

See code above:

/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac

with:

$ ls -la /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac
lrwxrwxrwx 1 root root 12 2006-10-20 
17:04 /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -> /usr/bin/ecj



> If it's a link to ecj, which it should be, this will work.

How?

$ /usr/bin/ecj -target 1.4 -source 1.4 -target 1.4 -source 1.4 -classpath 
src/JRI.jar -d examples examples/rtest.java

Gives:

duplicate target compliance setting specification: 1.4

where:

$ /usr/bin/ecj -version
Eclipse Java Compiler v_677_R32x, 3.2.1 release, Copyright IBM Corp 2000, 
2006. All rights reserved.

Actually, instead of commenting out that line in Makefile.all, you can also 
just remove the $(JFLAGS) to get:

examples/%.class: examples/%.java src/JRI.jar
$(JAVAC) -classpath src/JRI.jar -d examples $<

The first "-target 1.4 -source 1.4" is part of the $(JAVAC) var.

>  > which fails with:
>  >
>  > Error in dyn.load(x, as.logical(local), as.logical(now)) :
>  > unable to load shared
>  > library '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
>  >   libjvm.so: cannot open shared object file: No such file or directory
>  > Error in library(rJava) : .First.lib failed for 'rJava'
>  >
>  > Not sure what else I can/should try now. Ideas?
>
> Did you install rJava.so? 

Yes, using the R CMD INSTALL call in my first email.

> If so, where is it? 

See the above error message:

/usr/local/lib/R/site-library/rJava/libs/rJava.so

$ ls -al /usr/local/lib/R/site-library/rJava/libs/rJava.so
-rwxr-xr-x 1 egonw staff 128075 2006-10-22 
12:37 /usr/local/lib/R/site-library/rJava/libs/rJava.so


> Did it even get built?  

Yes.

The patch to apply to the source to get it compiled and installed now looks 
like:

=
diff -ru rJava-orig/jri/Makefile.all rJava/jri/Makefile.all
--- rJava-orig/jri/Makefile.all 2006-10-11 01:52:35.0 +0200
+++ rJava/jri/Makefile.all  2006-10-22 12:39:47.0 +0200
@@ -28,7 +28,7 @@
cp $< $@

 examples/%.class: examples/%.java src/JRI.jar
-   $(JAVAC) $(JFLAGS) -classpath src/JRI.jar -d examples $<
+   $(JAVAC) -classpath src/JRI.jar -d examples $<

 clean:
$(MAKE) -C src clean
diff -ru rJava-orig/src/Makevars.in rJava/src/Makevars.in
--- rJava-orig/src/Makevars.in  2006-10-11 01:52:30.0 +0200
+++ rJava/src/Makevars.in   2006-10-22 12:39:36.0 +0200
@@ -14,5 +14,5 @@
 jri:
$(MAKE) -C ../jri/
[EMAIL PROTECTED] -p ../inst/jri
-   
@(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/run ../jri/examples 
../inst/jri/)
+   
@(cp -r ../jri/src/JRI.jar ../jri/*jri.* ../jri/examples ../jri/run 
../inst/jri/)

=

Egon

-- 
[EMAIL PROTECTED]
Cologne University Bioinformatics Center (CUBIC)
Blog: http://chem-bla-ics.blogspot.com/
GPG: 1024D/D6336BA6


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: JGR with free java (was: GUI for R)

2006-10-22 Thread Andrew Haley
Egon Willighagen writes:
 > 
 > cc: debian-java -> I need a bit of help here, see below
 > 
 > On Wednesday 11 October 2006 15:48, Dirk Eddelbuettel wrote:
 > > | > Unfortunately, JGR is still somewhat outside Debian as it wants Sun's
 > > | > Java JDK so I don't think I'll ever package it directly.  Now, if
 > > | > someone wanted to outside of Debian ...  In fact, the CRAN maintainers
 > > | > mention that idea. Maybe one day.
 > > |
 > > | Did you try it with JamVM/Classpath? I will have a go at that in running
 > > | JGR, and report problems with the Classpath team.
 > >
 > > I do not use Java myself, so I wouldn't be the one to try this.  It would
 > > be nice if someone like you with R and Java clues coud try it.  I honestly
 > > do not know what is involved but I have the suspicion that it is no cake
 > > walk.
 > 
 > I've found out that it now actually is a package on CRAN, and installs fine, 
 > and really just depends on rJava for the Java binding. (JGR and rJava are 
 > downloaded as source tar.gz from [1]).
 > 
 > I had a brief go at installing rJava against GIJ:
 > 
 > $ JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0 R CMD 
 > INSTALL --library=/usr/local/lib/R/site-library rJava_0.4-11.tar.gz
 > 
 > (R comes with the package r-base).
 > 
 > You need to have java-gcj-compat-dev and libgcj-bc installed.
 > 
 > But it fails because of this call:
 > 
 > /usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac -target 1.4 -source 
 > 1.4 -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples 
 > examples/rtest.java
 > 
 > Note the duplicate '-target 1.4 -source 1.4', which is OK for the Sun javac, 
 > but breaks compiling with gcj 4.1 javac.

What is javac here?  If it's a link to ecj, which it should be, this
will work.

 > A workaround is not compiling the examples, which can be done by modifying 
 > (after tar zxvf) the rJava/jri/Makefile.all, and make it look like:
 > 
 > examples/%.class: examples/%.java src/JRI.jar
 > #$(JAVAC) $(JFLAGS) -classpath src/JRI.jar -d examples $<
 > 
 > Then the package installs.
 > 
 > However, running it still fails with this error:
 > $ R
 > 
 > 
 > and then on the R command line:
 > > library(rJava)
 > 
 > which fails with:
 > 
 > Error in dyn.load(x, as.logical(local), as.logical(now)) :
 > unable to load shared 
 > library '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
 >   libjvm.so: cannot open shared object file: No such file or directory
 > Error in library(rJava) : .First.lib failed for 'rJava'
 > 
 > Not sure what else I can/should try now. Ideas?

Did you install rJava.so?  If so, where is it?  Did it even get built?

Andrew.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]