What is jython used for
There are numerous alternative languages implemented for the Java VM. The following features help to separate Jython from the rest:. Jython 2. Working with Java. Python Docs exits. Jython FAQ. List Archives exit. JPython paper exit. See some from MVNRepository. What is Jython? Jython is complementary to Java and is especially suited for the following tasks: Embedded scripting - Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application.
Interactive experimentation - Jython provides an interactive interpreter that can be used to interact with Java packages or with running Java applications. Except for some standard modules, Jython programs use Java classes instead of Python modules. If you know Python and has bought into the "pythonic" way of doing things, then Jython allows you to bring that philosophy to the JVM stack. If you do this, it is much more than just adding scripting capability. In our latest projects, all the custom and business logic is built in Jython, at the same time we can still leverage some of the great tried and tested Java libraries like Solr, Jasperreports, Quartz, Jetty, Velocity to name a few.
It does get compiled to bytecode, however, an extra layer is being added, but is no different to using an ORM instead of straight JDBC for example. On the server side, Jython is rarely the bottleneck. For mini desktop apps, there may be issues, but very much dependent on what you are trying to do. The latest JDK, together with containers like Jetty or Tomcat are very mature and stable, adding Python on top, in many cases, gives the best of both worlds. When you want to program in Python but need or want to have the result run on a Java virtual machine, or use existing Java components.
That depends, as always, on your specific usecase. It may actually be faster than CPython in some cases; and of course it depends on the specific JVM you run under - these get better all the time. Jython is a Python implementation which runs on top of JVM. Theoretically, Jython is a bit slower, then CPython. The main drawback is that Jython lags behind the official CPython distribution. Currently, you can get a version of Jython that is compatible with Python 2.
Also some esoteric modules aren't supported. Compared to what? Usually, it's either fast enough or, when it isn't, you can replace a few lines of Python with about 1' lines of much faster Java. You can write administrative scripts for Websphere application server using Jython. The scripts are used to automate common administrative tasks and configure security in Websphere application server. As the Jython scripts are based on Java and they run on the JVM they can access those objects and can be utilized to configure WebSphere.
Here is the details. The JVM does some nice dynamic optimization, but it's probably nothing to get excited about. Java libraries are the main reason. Lots of companies have big globs of Java code that can be scripted with Python.
There's also a few open source frameworks Struts and Eclipse spring to mind which you can script with Jython.
0コメント