« RAN: RSS for dependency management? | Main | Jboss: Making deployment less of a PITA »

Running Java: I

First of a series on organizing projects and creating a good working environment for writing and managing Java code.

java

Install a JDK to c:/java or /usr/local/java. these will not be the default paths. If you have a jdk somewere else on your machine you want to use, make a note of where it is, but it's better if you uninstall it and start over.

Windows users: add these to your environment

   JAVA_ROOT=c:/java
JAVA_HOME=%JAVA_ROOT%/jdk1.3.1_07

Linux users: add these to your .profile

   JAVA_ROOT=/usr/local/java; export $JAVA_ROOT
JAVA_HOME=$JAVA_ROOT/jdk1.3.1_07; export $JAVA_HOME

Remember to change JAVA_HOME if you installed the JDK somewhere else - don't change JAVA_ROOT. We'll talk about how to set things up for multiple JDKs in a future installment.

ant and junit

Every Java project you work on will depend on these two - they are the most important java projects outside the JDK.

Unpack Ant 1.5.2 underneath $JAVA_ROOT. In windows add these envars to your environment:

     ANT_HOME=%JAVA_ROOT%/apache-ant-1.5.2
PATH=%PATH%;%ANT_HOME%\bin;

In Linux add these envars to your .profile:

     ANT_HOME=$JAVA_ROOT/apache-ant-1.5.2; export $ANT_HOME
PATH=$PATH;$ANT_HOME/bin; export $PATH

Fire up a command prompt and type 'ant -version':

  > ant -version
Apache Ant version 1.5.2 compiled

Copy the following jarfiles into $ANT_HOME/lib - jdepend.jar, junit.jar, catalina-ant.jar, jing.jar

The jars are available at http://www.dehora.net/code/ant/ext . You can test your ant setup by downloading them with this buildfile:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="ibs-third-party" default="get-ant-ext" basedir=".">
<property environment="env" />
<target name="get-ant-ext" description="" >
<property name="ant.loc" value="${env.ANT_HOME}/lib"/>
<property name="ant.href" value="http://www.dehora.net/code/ant/ext"/>
<get src="${ant.href}/jdepend.jar" dest="${ant.loc}/jdepend.jar"/>
<get src="${ant.href}/jing.jar" dest="${ant.loc}/jing.jar"/>
<get src="${ant.href}/junit.jar" dest="${ant.loc}/junit.jar"/>
<get src="${ant.href}/catalina-ant.jar" dest="${ant.loc}/catalina-ant.jar"/>
</target>
</project>

Notice already we are not dependent on the filesystem - this buildfile will work on ether Linux or Windows. Save the file somewhere as build.xml. Cd to that directory and type

 > ant

Unpack Junit3.8 underneath $JAVA_ROOT.


April 11, 2003 12:48 AM

Comments

matt
(April 11, 2003 02:44 PM #)

Forbidden
You don't have permission to access /code/ant/ext/ on this server.

Apache/1.3.27 Server at www.dehora.net Port 80

matt
(April 11, 2003 02:48 PM #)

nevermind. I can GET the jars individually but I can't list the directory.

Not that I would ever draw conclusions about your directory structure from URLs.

Bill de hra
(April 11, 2003 05:08 PM #)

Conclude away. I forgot to put a .htaccess file in that directory. It'll list now.

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/986