Leena Mansour | 11 Aug 18:12

instantiate python program inside java

Hello,
I don't know anything about python (I'm a student java coder), but I'm going to have to learn it since I can't do what I want in java.
Now the question is, is it possible to instantiate a whole python program inside java without turning the java files into .class files? so when I do something in the java program (click a button, etc..) the python program opens up?
Thanks!

--
LeEnA =)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Jeff Emanuel | 11 Aug 18:32
Favicon

Re: instantiate python program inside java


See the docs for embedding Jython in Java.  When you have
a Jython interpreter, you can tell it to execute your .py file.

http://www.jython.org/Project/userguide.html#embedding-jython

Leena Mansour wrote:
> Hello,
> I don't know anything about python (I'm a student java coder), but I'm going
> to have to learn it since I can't do what I want in java.
> Now the question is, is it possible to instantiate a whole python program
> inside java without turning the java files into .class files? so when I do
> something in the java program (click a button, etc..) the python program
> opens up?
> Thanks!
>
>   
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jython-users mailing list
> Jython-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users
>   

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Leena Mansour | 11 Aug 20:00

Re: instantiate python program inside java

oh cool..thanks!
so just to make sure I got this right, do I use exec from here http://www.jython.org/docs/javadoc/org/python/util/PythonInterpreter.html#exec(java.lang.String) where the string is the location of the .py file? or do I use execfile?

Thanks again

On Mon, Aug 11, 2008 at 12:32 PM, Jeff Emanuel <jemanuel <at> frii.com> wrote:

See the docs for embedding Jython in Java.  When you have
a Jython interpreter, you can tell it to execute your .py file.

http://www.jython.org/Project/userguide.html#embedding-jython


Leena Mansour wrote:
Hello,
I don't know anything about python (I'm a student java coder), but I'm going
to have to learn it since I can't do what I want in java.
Now the question is, is it possible to instantiate a whole python program
inside java without turning the java files into .class files? so when I do
something in the java program (click a button, etc..) the python program
opens up?
Thanks!

 ------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
 



--
LeEnA =)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Jeff Emanuel | 11 Aug 20:09
Favicon

Re: instantiate python program inside java

The argument to exec is a String containing code.
The argument to execfile is the filename.

Leena Mansour wrote:
> oh cool..thanks!
> so just to make sure I got this right, do I use exec from
> herehttp://www.jython.org/docs/javadoc/org/python/util/PythonInterpreter.html#exec(java.lang.String)<http://www.jython.org/docs/javadoc/org/python/util/PythonInterpreter.html#exec%28java.lang.String%29>where
> the string is the location of the .py file? or do I use execfile?
>
> Thanks again
>
> On Mon, Aug 11, 2008 at 12:32 PM, Jeff Emanuel <jemanuel <at> frii.com> wrote:
>
>   
>> See the docs for embedding Jython in Java.  When you have
>> a Jython interpreter, you can tell it to execute your .py file.
>>
>> http://www.jython.org/Project/userguide.html#embedding-jython
>>
>>
>> Leena Mansour wrote:
>>
>>     
>>> Hello,
>>> I don't know anything about python (I'm a student java coder), but I'm
>>> going
>>> to have to learn it since I can't do what I want in java.
>>> Now the question is, is it possible to instantiate a whole python program
>>> inside java without turning the java files into .class files? so when I do
>>> something in the java program (click a button, etc..) the python program
>>> opens up?
>>> Thanks!
>>>
>>>  ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Jython-users mailing list
>>> Jython-users <at> lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>>
>>>
>>>       
>
>
>   

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane