Thread: need Some help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    1
    Rep Power
    0

    need Some help


    Hi everybody,
    I am a novice user of python and to say i am not that aware of python .here i got a problem to convert some python code to Java ,i'll be grateful if any body gives some help in converting my code(which is given below to Java)

    Regards,
    Sena.
    The python code is zipped
    Attached Files
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    have you looked at Jython? This is a version of python written entirly in Java and runs under the JVM. In any case this could save you some work converting Python files into Java since you can compile Python programs though Jython to Java Bytecode! Letting them run on any JVM!

    http://www.jython.org/

    Hope this helps,

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    Why do you need the code in Java? What is wrong with using it in Python? It is not a library, so you will not be able to call it from Java. If you convert it to Java you will end up with code that is longer, less readable and maintainable, and will quite possibly not run any faster (it may even be slower). To be honest the code does not look very well written as it is and could do with serious refactoring, so porting it unchanged to Java will just make it worse.

    I also notice that it imports a number of external modules that are not part of the standard library. If you convert the program to Java, you will need to convert all of those as well.

    In short, either stick with Python, or use Jython if you need to extend it using the Java libraries.

    Dave - The Developers' Coach
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Daves right. And, the one reason i can think of that you might want to convert Python into Java is to run it on a system where the Python interpreter isnt available. In which case all you need is the Jython .

    Good luck,

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    If you have to install jython you might as well install python and save the aggro I think.

IMN logo majestic logo threadwatch logo seochat tools logo