Archive for Java

How to install JRuby on Rails on Mac and Linux

It is simpler than you might think to install JRuby on Rails on your Mac or Linux box. Note: Mac comes with Java and Apache Ant pre-installed, thank god.  Linux users need to make sure Java and Ant are installed before attempting to install JRuby on Rails.

Just follow these simple steps and you’ll be running JRuby on Rails on Mac or Linux in no time.
Read the rest of this entry »

How to install Apache Ant

### Overview ###

# Apache Ant is a “pure Java build tool”, and is used a lot in the Java world as a replacement for OS-specific build tools like “make”, “build”, “jam”, etc.

# Because Ant is pure-Java, it makes it easier to install/build Java applications due to its Java-by-nature code portability. The Catch: as long as the Java applications you want to build use Apache Ant as the build mechanism.  If they don’t, Ant is not gonna help you.  But most major Java apps now use Ant as the build mechanism, so better to have Ant installed than to not have Ant installed.

# Apache Ant is OS-independent, so it doesn’t matter what operating system you’re using to build your applications from source, but Apache Ant is Java-dependent, so it does require Java be installed (like Sun’s JRE, JDK, OpenJDK, IcedTea, etc.) and does require that you have a user/system environment set called $JAVA_HOME and pointed to the location that you have your Java package installed.  

# Side note: This can be confusing to some Mac users (me) because they know (or believe) Java is already installed with Mac OS X Leopard, but they (I) don’t know the longass directory it’s installed to (see http://developer.apple.com/java/javaleopard.html). So I choose to install a fresh version of Java SDK onto my Mac while I already believe to have Java installed, but I’m not 100% sure where, how, why,…okay, so I install it so I know where the heck it is on my computer and, most importantly, how to delete it and start over if tides get rough… please read on…

# Why bother with Apache Ant as a Flex on Ruby on Rails developer?  Most importantly, you’ll need it to install JRuby!!! JRuby allows Ruby programmers (me) to connect to the vast libraries and applications and technologies and money-paying gigs (not me) that exist in the Java world.  Hopefully more answers to come…

# Bottom Line: Apache Ant is pretty freakin cool for what it does. Think of Apache Ant doing the same for Java that the brilliant Rake does for Ruby.  Ant greatly simplifies the installation process of most major Java applications from source code. While you could theoretically install a pure-Ruby application using Apache Ant, and at the same time, you could theoretically install a pure-Java application using Rake, this is not common practice.  So for now just think of it as, for lack of a better brain-reminder, Ant installs Java stuff and Rake installs Ruby stuff.

# Why not build Ant from source code?  Well, because it’s not necessary.  It’s just one extra step to build.sh before installing…
Read the rest of this entry »