Python
  Home arrow Python arrow Page 2 - Introduction to Jython
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Introduction to Jython
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 21
    2005-02-22

    Table of Contents:
  • Introduction to Jython
  • Installing Jython
  • Calling Java Classes
  • Embedding

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Introduction to Jython - Installing Jython
    (Page 2 of 4 )

    Jython may be obtained from the Jython website:

    http://www.jython.org

    Currectly, the latest version is Jython 2.1. Download it and then move to the directory where it is installed. Next, open the file with your Java interpreter. For example:

    java jython-21

    The installation program will be presented to you, and installing it from there should be pretty straightforward. If you're using Jython 2.1 in conjunction with Java 1.4 or later, be sure to include the source in your installation. Move to the directory where you installed Jython and open up "org/python/core/Py.java" in your favorite text editor. Replace every appearance of "assert" with "a_ssert" and ever appearance of "enum" with "e_num". Do the same with "org/python/compiler/CodeCompiler.java" and "org/python/parser/PythonGrammar.java". Note that the latter will require you to replace "e_numeration" to "Enumeration" when you are done. Jython 2.1 uses the two terms, which were set as keywords in Java 1.4.

    Once you're done, move to the directory where you installed Jython and start up the Jython interactive interpreter:

    jython

    If everything has gone correctly, you should see something that looks a lot like the Python interactive interpreter. Let's test it out by executing some Python code:

    >>> print 'Hello World!'
    Hello World!
    >>> import math
    >>> print math.sqrt ( 25 )
    5.0
    >>> someList = [ 5, 3, 4, 2 ]
    >>> print someList [ 0 ]
    5
    >>> print math
    (module 'math' (built-in))

    As you can see, things work exactly the same as they do in Python.

    More Python Articles
    More By Peyton McCullough


       · Nice =) Great subject, well written as usual
       · Is this real? Jython?
       · If you had read the article I don't think you'd be asking that question, but yes, it...
       · Thanks, David!I wrote this article because I find Jython extremely interesting....
       · I like the idea. I like python, especially for quick and dirty Unix tasks, like...
       ·  If you want to read how, see this...
       · Well, programming languages typically derive from the desire to complete a certain...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway