# Using Antwrap in Ruby

**URL:** <https://www.ruby-forum.com/t/using-antwrap-in-ruby/143879>\
**Category:** Ruby\
**Created:** [July 23, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/using-antwrap-in-ruby/143879 "2008-07-23T14:00:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@srinu](https://www.ruby-forum.com/u/srinu)\
**Post date:** [July 23, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/using-antwrap-in-ruby/143879/1 "2008-07-23T14:00:44Z")

</div>

Hi ,

I am trying to install Antwrap-0.7.0.gem and rjb-1.1.x gems in cygwin  
and windows also , I’m stuck so I thought I ping out to see if anyone  
else has done  
this. Last one week i have been working on issue .Any help would be  
appreciated.

## Error states that in this below manner.

$ gem install Antwrap-0.7.0.gem  
ERROR: [http://gems.rubyforge.org/](http://gems.rubyforge.org/) does not appear to be a repository  
Building native extensions. This could take a while…  
ERROR: Error installing Antwrap-0.7.0.gem:  
ERROR: Failed to build gem native extension.

/usr/bin/ruby.exe extconf.rb install Antwrap-0.7.0.gem  
checking for jni.h… no  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

Provided configuration options:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–without-make-prog  
–srcdir=.  
–curdir  
–ruby=/usr/bin/ruby

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rjb-1.1.3  
for ins  
pection.  
Results logged to /usr/lib/ruby/gems/1.8/gems/rjb-1.1.3/ext/gem\_make.out

Here’s the ext/mkmf.log file

have\_header: checking for jni.h… -------------------- no

“gcc -E -I. -I/usr/lib/ruby/1.8/i386-cygwin -I. -IC:\Program  
Files\Java\jdk1.5.0\_11/include -IC:\Program  
Files\Java\jdk1.5.0\_11/include/win32 -g -O2 -IC:\Program  
Files\Java\jdk1.5.0\_11/include -IC:\Program  
Files\Java\jdk1.5.0\_11/include/win32 conftest.c -o conftest.i”  
gcc: FilesJavajdk1.5.0\_11/include: No such file or directory  
gcc: FilesJavajdk1.5.0\_11/include/win32: No such file or directory  
gcc: FilesJavajdk1.5.0\_11/include: No such file or directory  
gcc: FilesJavajdk1.5.0\_11/include/win32: No such file or directory  
In file included from conftest.c:1:  
/usr/lib/ruby/1.8/i386-cygwin/jni.h:27:20: jni\_md.h: No such file or  
directory  
checked program was:  
/\* begin _/  
1: #include \<jni.h\>  
/_ end \*/

Regards,  
M.SrinivasaRao.

---

<div class="post-metadata">

**Author:** ![srinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@srinu](https://www.ruby-forum.com/u/srinu)\
**Post date:** [July 23, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/using-antwrap-in-ruby/143879/2 "2008-07-23T14:54:04Z")

</div>

Hi Srinivasa,

there are two distribution of Antwrap:

- This first one is for C based Ruby interpreter (MRI). It has a  
dependency on RJB (RubyJavaBridge), a gem that enables  
you to load and instantiate Java Classes from within a ruby process.  
Antwrap needs this to load and execute Ant tasks.

- The second distro is meant to run on JRuby, and thus has no no  
dependency on RJB because it can load Java classes via the  
interpreter.

When you install Antwrap, it will ask you to choose the distribution  
with the choice of Ruby or Java. You have chosen the first option, and  
the failure is occurring during the installation  
of RJB. It is trying to compile it’s classes using the gcc, but it is  
having problems resolving the location of your JAVA\_HOME (RJB needs to  
link to some C libraries in the JVM).  
This problem is probably due to the Cygwin paths. Try putting this  
into your .bashrc or .bash\_profile file:

export JAVA\_HOME=$(cygpath -ua $JAVA\_HOME)  
export PATH=$JAVA\_HOME/bin:$PATH

There are some other suggestions on how to solve this here:

[http://arton.no-ip.info/collabo/backyard/?HowToBuildRjb](http://arton.no-ip.info/collabo/backyard/?HowToBuildRjb)

Let me know how this goes for you.

On Wed, Jul 23, 2008 at 7:55 AM, Srinivasa R.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> $ gem install Antwrap-0.7.0.gem  
> details. You may need configuration options.  
> –srcdir=.
> 
> gcc: FilesJavajdk1.5.0\_11/include: No such file or directory
> 
> ## Regards, M.SrinivasaRao.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

–  
Caleb

“I do not know which makes a man more conservativeâ€”to know nothing but  
the present, or nothing but the past.”

- John Maynard Keynes

---

<div class="post-metadata">

**Author:** ![srinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@srinu](https://www.ruby-forum.com/u/srinu)\
**Post date:** [July 29, 2008, 8:45am UTC](https://www.ruby-forum.com/t/using-antwrap-in-ruby/143879/3 "2008-07-29T08:45:47Z")

</div>

Hi Caleb,

Thank for your helpful suggestions.

Installed rjb and antwrap successfully.Started working on antwrap.

## My code is below.

options = {:ant\_home=\>“D://apache-ant-1.7.1”, :name=\>‘BotServer’,  
:basedir=\>“C://InstantRails-1.3a-with-PHP-5.1.4//InstantRails//rails\_apps”,  
:declarative=\> true, :logger=\> Logger.new(STDOUT),  
:loglevel=\> Logger::DEBUG}  
puts “options------------------------------1”  
antProject = AntProject.new(options)  
antTask = AntTask.new(‘ws-run -DD=PRnnn’, antProject, {:debug  
=\> ‘on’, :verbose =\> ‘no’, :fork =\> ‘no’})  
puts “before task------------------------------”  
antTask.execute()

## While running i am facing problems.

→ up to options i was able to execute.  
 → then i am getting error in this below manner (debugger not at all  
excecute ant project code.)

## My varaiables shows this value for creating instance for AntProject

exception uninitialized constant TestRunsController::AntProject  
@blamed\_files Empty Array  
md nil  
msg nil  
origin\_file nil  
origin\_line nil

Here TestRunsController is my controller.

Could you please help me in this regard.

* * *

Caleb P. wrote:

> Hi Srinivasa,
> 
> there are two distribution of Antwrap:
> 
> - This first one is for C based Ruby interpreter (MRI). It has a  
> dependency on RJB (RubyJavaBridge), a gem that enables  
> you to load and instantiate Java Classes from within a ruby process.  
> Antwrap needs this to load and execute Ant tasks.
> 
> - The second distro is meant to run on JRuby, and thus has no no  
> dependency on RJB because it can load Java classes via the  
> interpreter.
> 
> When you install Antwrap, it will ask you to choose the distribution  
> with the choice of Ruby or Java. You have chosen the first option, and  
> the failure is occurring during the installation  
> of RJB. It is trying to compile it’s classes using the gcc, but it is  
> having problems resolving the location of your JAVA\_HOME (RJB needs to  
> link to some C libraries in the JVM).  
> This problem is probably due to the Cygwin paths. Try putting this  
> into your .bashrc or .bash\_profile file:
> 
> export JAVA\_HOME=$(cygpath -ua $JAVA\_HOME)  
> export PATH=$JAVA\_HOME/bin:$PATH
> 
> There are some other suggestions on how to solve this here:
> 
> [http://arton.no-ip.info/collabo/backyard/?HowToBuildRjb](http://arton.no-ip.info/collabo/backyard/?HowToBuildRjb)
> 
> Let me know how this goes for you.
> 
> On Wed, Jul 23, 2008 at 7:55 AM, Srinivasa R.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > $ gem install Antwrap-0.7.0.gem  
> > details. You may need configuration options.  
> > –srcdir=.
> > 
> > gcc: FilesJavajdk1.5.0\_11/include: No such file or directory
> > 
> > ## Regards, M.SrinivasaRao.
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> –  
> Caleb
> 
> “I do not know which makes a man more conservativeâ€”to know nothing but  
> the present, or nothing but the past.”
> 
> - John Maynard Keynes
