Differences between revisions 15 and 16
Revision 15 as of 2008-05-13 23:34:02
Size: 6082
Editor: 70
Comment:
Revision 16 as of 2008-05-13 23:45:47
Size: 4588
Editor: 70
Comment: rip out stuff about ant.properties that is more confusing than helpful
Deletions are marked like this. Additions are marked like this.
Line 35: Line 35:
At this point, you should be able to build the project using Eclipse's `Java Builder`. This will only compile the classes though --you'll want to use `<yourProjectName>/build.xml` to get the full ant build. (Jython won't run without this.) To do this:
 *First, set up an `ant.properties` file to supply "parameters" to `build.xml`
  *Put the file directly under `<yourProjectName>/`. It has to be in the same directory as `build.xml`, or in `user.home`. This is because build.xml explicitly searches two directories for `ant.properties`: `user.home` and the directory where `build.xml` is located (in this order). When in doubt, `ant -f build.xml usage` will tell you.
  *Put in info such as
{{{
    build.compiler=modern
    debug=false
    #debuglevel=lines,vars,source
    optimize=false

    #javaccHome=/Users/bzimmer/Library/Java/Extras/javacc-3.2

    ht2html.dir=

    ### zxJDBC ###
    #oracle.jar=
    #mysql.jar=/Users/bzimmer/Library/Java/Extras/mysql-connector-java-3.1.6-bin.jar
    #informix.jar=
    #postgresql.jar=/Users/bzimmer/Library/Java/Extras/pg74.215.jdbc2.jar
    #jdbc.jar=
    #servlet.jar=
}}}
  I left stuff commented out, but you can see how you can add jars, etc. using this file.
 *Navigate to `build.xml` and Right-Click and select `Run` | `External Tools`.
 *Select `New` and on the `Main` tab
  *For `Buildfile:`, the default of `${workspace_loc:/<yourProjectName>/build.xml}` should be fine
  *For `Base Directory:`, click `Browse Workspace` and navigate to the `<yourProjectName>` directory and select it
  *Click on the `Properties` tab
  *Unselect the `Use global properties as specified...` check box
  *Click the `Add External` button and navigate to and select `<yourProjectName>/ant.properties`
  *Select `Apply` and `Run`
At this point, you should be able to build the project using Eclipse's `Java Builder`. This will only compile the classes though --you'll want to use `<yourProjectName>/build.xml` to get the full ant build. (Jython won't run without this.) To do this, right click on build.xml and choose Run As Ant Build.

ClarkUpdike, incept: 2005-02-10

Setting up the jython development environment in Eclipse

Eclipse has a plugin to become a SVN client and can be used to get the project from the repository. It takes a few steps to set it up, but seems to work well once you do. Please correct any mistakes. (Works for Eclipse 3.1-3.3)

Installing the Subclipse plugin

Checking out the Jython project

  • Switch to SVN Repository Exploring perspective
  • Add a new SVN repository, URL: https://jython.svn.sourceforge.net/svnroot/jython

  • Select trunk/jython from the repository tree and Checkout the project using the New Project Wizard.
  • Set up source folders for the project

Building the project using ANT

Anchor(ANT) At this point, you should be able to build the project using Eclipse's Java Builder. This will only compile the classes though --you'll want to use <yourProjectName>/build.xml to get the full ant build. (Jython won't run without this.) To do this, right click on build.xml and choose Run As Ant Build.

A successful build should output something like the following:

Buildfile: c:\workspace\JythonTip\jython\build.xml
init:
     [echo] --- Build environment for jython ---
     [echo] --- Flags (Note: If the {property name} is displayed,
     [echo] --- then the component is not present)
     [echo] --- Optional Libraries ---
     [echo] java2 coll  = true
     [echo] servlet     = ${servlet.present}
     [echo] readline    = ${readline.present}
     [echo] oracle      = ${oracle.present}
     [echo] informix    = ${informix.present}
     [echo] mysql       = ${mysql.present}
     [echo] postgresql  = ${postgresql.present}
     [echo] jndi        = true
     [echo] jdbc        = true
     [echo] jdbc3.0     = true
dist-prepare:
prepare:
parser:
compile:
jar:
   [delete] Deleting: C:\workspace\JythonTip\jython\build\mainClass.mf
copy-xml:
copy-dist:
BUILD SUCCESSFUL
Total time: 2 seconds

Note that this sample was actually a re-build, so it didn't do that much (you'll see more output on the first build) and ran pretty fast (2 seconds). Also, note that I did not link in the optional "user-supply-able" jars. To do so, just add those entries to your ant.properties (look for the placeholders).

Also, you can specify the ant targets that you want to run using the Targets tab under External Tools dialog. For example, the copy-dist seems to run by default. To force a full build, check the all target.

And here is a [wiki:/JythonDeveloperGuide sample batch file (windows)] that runs the eclipse-built jython.jar If you set the default output directory to build in the Build Path setup, you can replace the jython.jar in your script with the path to build. That means after running the initial Ant build you can just rerun your Jython script and it will reflect the latest changes you've made to the java code.

JythonDeveloperGuide/EclipseNotes (last edited 2012-06-03 22:23:41 by JeffAllen)