You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by chihiro <ga...@gmail.com> on 2008/10/07 15:50:35 UTC

Problem compiling with buildr

I'm not sure if this is due to buildr/JRuby but if you can eliminate it from
the list of possible causes, that'll be great.

Firstly, I can compile code by hand using javac in a cygwin bash shell. So
$JAVA_HOME / $PATH are correctly defined.

But when I do a "buildr install", I get the following in
http://pastebin.com/f1c3f663e

Thanks.

Regards,

Gavin
-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19858629.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.
Alex,


Alex Boisvert-3 wrote:
> 
> You might want to check that JAVA_HOME points to a JDK and not a JRE. 
> 

$ echo $JAVA_HOME
C:\_programs\jdk1.6.0_04


$ echo $JRUBY_HOME
/opt/jruby-1.1.4


$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/_programs/jdk1.6.0_04/bin:
..snipped-for-brevity.. 
:/cygdrive/c/_programs/apache-maven-2.0.9/bin:/opt/jruby-1.1.4/bin


$ jar tvf $JAVA_HOME/lib/tools.jar | grep "com/sun/tools/javac/main/Main"
  1927 Fri Dec 14 00:59:12 SGT 2007 com/sun/tools/javac/main/Main$1.class
   489 Fri Dec 14 00:59:12 SGT 2007 com/sun/tools/javac/main/Main$2.class
 10944 Fri Dec 14 00:59:12 SGT 2007 com/sun/tools/javac/main/Main.class

$ javac -version
javac 1.6.0_04



Regards,

Gavin

-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19894028.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by Alex Boisvert <bo...@intalio.com>.
You might want to check that JAVA_HOME points to a JDK and not a JRE.  One
difference with the JDK is that it includes tools.jar (and thus, javac).

Typically $JAVA_HOME/lib/tools.jar

alex


On Tue, Oct 7, 2008 at 10:50 PM, chihiro <ga...@gmail.com> wrote:

>
> I'm not sure if this is due to buildr/JRuby but if you can eliminate it
> from
> the list of possible causes, that'll be great.
>
> Firstly, I can compile code by hand using javac in a cygwin bash shell. So
> $JAVA_HOME / $PATH are correctly defined.
>
> But when I do a "buildr install", I get the following in
> http://pastebin.com/f1c3f663e
>
> Thanks.
>
> Regards,
>
> Gavin
> --
> View this message in context:
> http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19858629.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>

Re: Problem compiling with buildr

Posted by Assaf Arkin <ar...@intalio.com>.
Java would have no problem finding the file in
'c:/_programs/jdk1.6.0_04/lib/tools.jar'; I'm not sure if it can
access the file in  '/cygdrive/c/_programs/jdk1.6.0_04/lib/tools.jar'.
 AFAIK it has to be a Cygwin executable for that, otherwise it's
looking for a root directory (cygdrive) that doesn't exist in the
Windows file system.

Assaf

On Sun, Oct 12, 2008 at 6:49 AM, chihiro <ga...@gmail.com> wrote:
>
> Note that I am unable to run your command verbatim because it gives me:
>
> $ jruby -e "load
> '/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java/_buildr'; puts
> ENV['JAVA_HOME']"
> -e:1:in `load': No such file to load --
> /opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java/_buildr
> (LoadError)
>        from -e:1
>
> So I had to chdir to the directory hosting the '_buildr' file & run it
> there.
>
> $ jruby -e "load '_buildr'; puts ENV['JAVA_HOME']"
> (in
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java,
> development)
> No projects defined for directory
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
> [Completed] Your build has completed:
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
> buildr default
> Completed in 8.343s
> /cygdrive/c/_programs/jdk1.6.0_04
>
>
> --
> View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19941848.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>

Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.
Note that I am unable to run your command verbatim because it gives me:

$ jruby -e "load
'/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java/_buildr'; puts
ENV['JAVA_HOME']"
-e:1:in `load': No such file to load --
/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java/_buildr
(LoadError)
        from -e:1

So I had to chdir to the directory hosting the '_buildr' file & run it
there.

$ jruby -e "load '_buildr'; puts ENV['JAVA_HOME']"
(in
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java,
development)
No projects defined for directory
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
[Completed] Your build has completed:
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
buildr default
Completed in 8.343s
/cygdrive/c/_programs/jdk1.6.0_04


-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19941848.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by lacton <la...@users.sourceforge.net>.
This is getting very puzzling.

So far, we've seen that

#1. JRuby can see tools.jar

File.exist?('c:/_programs/jdk1.6.0_04/lib/tools.jar') => true

#2. the 'java.home' property of JRuby points to the JRE

Java.java.lang.System.getProperty('java.home') => 'c:\_programs\jdk1.6.0_04\jre'

#3. the Java.tools_jar method reports it cannot find 'tools.jar'

Java.tools_jar => nil

How can #1-2 and #3 be true at the same time? Could there be a wrong
value in ENV['JAVA_HOME']?

What do you get when you run

jruby -e "load '/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java/_buildr'
; puts ENV['JAVA_HOME']"

?

Lacton

On Sat, Oct 11, 2008 at 2:51 PM, chihiro <ga...@gmail.com> wrote:
>
> Lacton,
>
> Here's the output:-
>
> c:/_programs/jdk1.6.0_04/jre/lib/tools.jar false
> c:/_programs/jdk1.6.0_04/lib/tools.jar true
>
>
>
> lacton wrote:
>>
>> Sorry to ask you one more time, but will you try the following command
>> in your environment?
>>
>> jruby -e "['lib/tools.jar', '../lib/tools.jar'].map { |path|
>> File.expand_path(path, Java.java.lang.System.getProperty('java.home'))
>> }.each { |f| puts %{#{f} #{File.exist?(f)}} }"
>>
>

Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.
Lacton,

Here's the output:-

c:/_programs/jdk1.6.0_04/jre/lib/tools.jar false
c:/_programs/jdk1.6.0_04/lib/tools.jar true



lacton wrote:
> 
> Sorry to ask you one more time, but will you try the following command
> in your environment?
> 
> jruby -e "['lib/tools.jar', '../lib/tools.jar'].map { |path|
> File.expand_path(path, Java.java.lang.System.getProperty('java.home'))
> }.each { |f| puts %{#{f} #{File.exist?(f)}} }"
> 

-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19932354.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by lacton <la...@users.sourceforge.net>.
On Fri, Oct 10, 2008 at 3:51 AM, chihiro <ga...@gmail.com> wrote:
> Yes. It is pointing to a jre.
>
> $ jruby -e "puts Java.java.lang.System.getProperty('java.home')"
> c:\_programs\jdk1.6.0_04\jre
>
> But,
>
> $ echo $JAVA_HOME
> C:\_programs\jdk1.6.0_04
>
> I'll have to figure out why the "jre" is appended to JAVA_HOME.

I still wonder why buildr cannot find tools.jar. Buildr should know
how to handle this case.

Sorry to ask you one more time, but will you try the following command
in your environment?

jruby -e "['lib/tools.jar', '../lib/tools.jar'].map { |path|
File.expand_path(path, Java.java.lang.System.getProperty('java.home'))
}.each { |f| puts %{#{f} #{File.exist?(f)}} }"

Lacton

Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.

lacton wrote:
> 
> Maybe jruby is pointing to a JRE instead of a JDK.
> 

Yes. It is pointing to a jre.

$ jruby -e "puts Java.java.lang.System.getProperty('java.home')"
c:\_programs\jdk1.6.0_04\jre

But,

$ echo $JAVA_HOME
C:\_programs\jdk1.6.0_04

I'll have to figure out why the "jre" is appended to JAVA_HOME.

Thanks

Gavin
-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19910517.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by lacton <la...@users.sourceforge.net>.
On Thu, Oct 9, 2008 at 9:53 AM, chihiro <ga...@gmail.com> wrote:
> This is the output that I got.
>
> gavin@yoda /opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
> $ jruby -e "load '_buildr'; puts Java.tools_jar"
> (in
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java,
> development)
> No projects defined for directory
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java?
> [Completed] Your build has completed:
> C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
> buildr default
> Completed in 14.766s
> nil
>
> Regards,
>
> Gavin

We're getting somewhere.  For some reason, Buildr cannot locate
tools.jar, hence the 'nil' at the end of the output.

Can you try the following command?
jruby -e 'puts Java.java.lang.System.getProperty("java.home")'

Maybe jruby is pointing to a JRE instead of a JDK.

Lacton

Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.

Assaf Arkin wrote:
> 
> In the Buildr source directory there's a file called _buildr, running:
> 
> jruby -e "load '_buildr' ; puts Java.tools_jar"
> 
> loads that file, initializing Buildr and then checks if Buildr can guess
> where tools.jar is
> 

This is the output that I got.

gavin@yoda /opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
$ jruby -e "load '_buildr'; puts Java.tools_jar"
(in
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java,
development)
No projects defined for directory
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java?
[Completed] Your build has completed:
C:/_programs/cygwin/opt/jruby-1.1.4/lib/ruby/gems/1.8/gems/buildr-1.3.3-java
buildr default
Completed in 14.766s
nil

Regards,

Gavin
-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19894120.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by Assaf Arkin <ar...@intalio.com>.
In the Buildr source directory there's a file called _buildr, running:

jruby -e "load '_buildr' ; puts Java.tools_jar"

loads that file, initializing Buildr and then checks if Buildr can guess
where tools.jar is.

Assaf


On Wed, Oct 8, 2008 at 1:07 AM, chihiro <ga...@gmail.com> wrote:

>
> $ jruby -e "load '_buildr'"
> -e:1:in `load': No such file to load -- _buildr (LoadError)
> from -e:1
>
> $ jruby -e "puts Java.tools_jar"
> Java::Tools_jar
>
> I created a simple maven2 project and "mvn install" compiles fine in the
> same cygwin shell.
>
> Regards,
>
> Gavin
> --
> View this message in context:
> http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19874242.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>

Re: Problem compiling with buildr

Posted by chihiro <ga...@gmail.com>.
$ jruby -e "load '_buildr'"
-e:1:in `load': No such file to load -- _buildr (LoadError)
from -e:1

$ jruby -e "puts Java.tools_jar"
Java::Tools_jar

I created a simple maven2 project and "mvn install" compiles fine in the
same cygwin shell.

Regards,

Gavin
-- 
View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19874242.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Problem compiling with buildr

Posted by lacton <la...@users.sourceforge.net>.
What do you get if you run the following command from your buildr directory

jruby -e "load '_buildr' ; puts Java.tools_jar"

?

Lacton

On Tue, Oct 7, 2008 at 3:50 PM, chihiro <ga...@gmail.com> wrote:
>
> I'm not sure if this is due to buildr/JRuby but if you can eliminate it from
> the list of possible causes, that'll be great.
>
> Firstly, I can compile code by hand using javac in a cygwin bash shell. So
> $JAVA_HOME / $PATH are correctly defined.
>
> But when I do a "buildr install", I get the following in
> http://pastebin.com/f1c3f663e
>
> Thanks.
>
> Regards,
>
> Gavin
> --
> View this message in context: http://www.nabble.com/Problem-compiling-with-buildr-tp19858629p19858629.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>