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

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0

    Java with python


    Hi,

    I want to execute python code from my java code. I searched on Google, but no solution is working. Can any one help?
    Thanks in advance.

    Regards,
    Sachin Bali
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,900
    Rep Power
    481
    There's jython which is python written in java. Might help.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    114
    Rep Power
    3
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0
    Hi,

    Thanks for your reply!
    I am using net beans. And there is no package called Jython.
    I tried to search in Google. I download that module. It was .jar file. But i am not able include that in my code.

    What can be the issue ?


    Regards,
    Sachin Bali
  8. #5
  9. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,900
    Rep Power
    481
    Ask in the java forum? Since jython is a java implementation of python you'd need to run java first.

    So the command is probably
    Code:
    $ java (switches unknown to me) jython.jar (more options unknown to me)
    [code]Code tags[/code] are essential for python code and Makefiles!
  10. #6
  11. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    611
    Rep Power
    65
    What is your OS?

    On Windows you simply double click on the jython.jar file and Java takes care of the installation.

    For using Netbeans with Jython see:
    http://www.jython.org/jythonbook/en/1.0/JythonIDE.html#netbeans
    and
    http://wiki.netbeans.org/DevelopingJythonAppsUsingNetbeans

    Note for versions 7 and higher of Netbeans:
    Just go to Tools->Plugins, click Settings. Click Add, and add a new "Update Center" , name it like "Python plugin is here", and in the link, paste this:

    http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz

    Then go to Avaliable Plugins, do "Reload Catalog" - you should see stuff under "category" Python. Select the plugin and click install. Netbeans will ask you to restart itself. Then you should see Python under installed plugins (make sure to click "Show Details" there.
    Be warned that Jyson is slow since it is written in a slow language like Java. IMHO the Netbeans IDE is a bloated monster that takes up 700MB and is rather frustrating to use. I have been trying to uninstall the beast, but it keeps telling that it is still running in a locked folder that I simply can't get to.
    Last edited by Dietrich; December 30th, 2012 at 11:50 AM.
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25

IMN logo majestic logo threadwatch logo seochat tools logo