Jump to content

Jython: How to create executable file?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
niggoo

niggoo

    Newbie

  • Members
  • Pip
  • 5 posts
Hello,
today I tried Jython for the first time. I created a file test.py, containing Python and Java code which creates a GUI using Swing.
It works, I can try it using the command "jython test.py".
But how can I create an executable file?

Thanks for every help.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Python is a scripting language, so you don't normally compile it to executable. With that said, there are some workarounds.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
niggoo

niggoo

    Newbie

  • Members
  • Pip
  • 5 posts
Yes, I know. But with Jython it should be possible to compile it to executable *.jar-files. How does it work?

OK, my source code:
from javax.swing import JFrame, JButton


frame = JFrame("My first swing GUI", size=(300, 150))

button = JButton("Click me")

frame.add(button)

frame.visible = True


print("Close this window")

I saved it as test.py and run it using "jython test.py". What do I need to enter in the console (or a batch file) to compile it as a *.jar-file?

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
I haven't used it, but I'm guessing these would be good resources:
The Definitive Guide to Jython — Jython Book v1.0 documentation
Current Documentation
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users