Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to wrap python around java using jython

 
Sony Chau
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been assigned a task to convert a java standalone application to python web application.Recoding the entire module in python language would take a lot of time and effort.Hence I was adviced to do a quick wrap up of python and get the code working (Jython is Python wrap for JAVA )..Could any one guide me how to get started as I am new to Python as well as Jython?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. I'm not sure Jython helps you at all here. Jython is a Python interpreter written in Java; it lets you run Python code inside a Java application. What you want to do is quite the opposite, if I understand you correctly: you want a Python application -- the web container -- to run some Java code. If the Java code just accepts command-line arguments and spits out some output in a file or on standard output, this would be fairly simple -- you could use use call from the Python subprocess module -- but if the Java program has a GUI, it's going to need to be substantially modified for you to be able to make this work.
 
Sony Chau
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.You've understood my requirement correctly.My application has made use of java swing GUI.You have mentioned it would require substantial modifications to make the application work.Could you throw some light as to what kind of modifications are required and how do I proceed.Currently java swing GUI makes use of lot of JTables and JTabbedPanes.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, sadly, the whole GUI will have to be removed; you'll have to write a new GUI which works via HTML and Javascript. You may write it in Python or in Java, but I imagine Python would be easier here, using whatever GUI framework the Python web container is set up to use. The rest of the application -- the non-GUI parts -- may have to be modified to deal with multiple simultaneous users. For example, if part of the application writes to a file with a hard-coded name and path, then that code will need to change.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic