File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Building Jython Files using Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Building Jython Files using Ant" Watch "Building Jython Files using Ant" New topic
Author

Building Jython Files using Ant

Raj Sikka
Ranch Hand

Joined: Apr 11, 2003
Posts: 34
Hi ,
I am new to ANT.
I have one build.xml file which builds some java files .
Now I have to include Jython files to it .
I mean i need to compile jython files along with java files.
Any idea how to do this ?
Also Can any one suggest where i can get some code samples for the same.
Thanks,
Raj
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
jythonc does the conversion of jython (python files) to java classes?
If so you s'd be able to use "exec" task to run the jythoc executable supplying command line parameters. I guess jythonc s'd be in path / full path to jythonc can also be supplied to exec task.
There c'd be better ways of doing this but this is the simplest solution that comes to my mind now.
Someone here c'd suggest a better solution.
Raj Sikka
Ranch Hand

Joined: Apr 11, 2003
Posts: 34
Hi Kartik,
If you have idea about code to write in build.xml to compile jython file,
please send me one sample.
It is true as you said that jythonc creates class files from .py files.
Thanks,
Raj
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Raj Sikka:
please send me one sample.
[/QB]

I dont have Jython installed right now. But you can have a target that c'd look like this.
You need to fill up command line args that you want to pass ( can possibly get it by typing jythonc on the command prompt). Supply the path to jythonc as well. If i remember correctly it was a bat file?
"dir" is the directory whre you have your python source files.

"exec" just executes the bat file as is with the arguments that you supply using "arg"
That said there c'd be better ways of integrating python with your overall project. Rick is the author of a Jython book and we are lucky to have him here and infact he can help too.
HTH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Building Jython Files using Ant