250.html ( File view )
- By 2010-08-21
- View(s):12
- Download(s):0
- Point(s): 1
Safari | Python Developer's Handbook -> jpythonc
See All Titles |
![]() ![]() jpythoncThe JPython distribution provides a tool called jpythonc that works like a Python compiler for Java. This tool, which is actually just a JPython script, operates by taking a JPython source code (extension .py), and compiling it to real Java class bytecodes, which are executed by the Java Runtime Environment (JRE). Therefore you can write your code in JPython, and later use jpythonc to generate a simple class, a JavaBean, a servlet, or an applet. Note that you need full access to a Java compiler in order to use jpythonc. Internally, the jpythonc tool creates a Java source file file, but it needs an external compiler to generate the compiled Java .class file. Check the installation directory where you installed the JPython package. That's where the tool is located. The jpythonc tool is very useful for embedding your JPython application in a Java application. After you generate the .class file, you are able to subclass Python classes in Java, and also to create JavaBeans, Servlets, and Applets from a Python class file. The jpythonc script accepts several command line options, as listed next. The general format of the command's syntax is as follows: jpythonc [options] [module]* The available options are listed as follows. Note that the information provided between parenthesis shows a short way to say the same thing that the long name's option says.
In order to create an applet, the following syntax is suggested. Note that you need to use the -core option in order to include the JPython libraries as part of the applet. jpythonc -core -deep -jar <appletapp.jar> *.py In order to create a simple class, the following syntax is suggested: jpythonc <yourapp.py> Now, if you just need to create a bean, the following syntax should be used: jpythonc -deep -bean <filename.jar> <beenname>
|
Your Point isn't enough.
Get point immediately by PayPal
More(Debit card / Credit card / PayPal Credit / Online Banking)