Introduction to Jython

zhaozj2021-02-16  50

Before introducing Jython, let's take a look at the Python language.

"Python, is a simple, interpretable, interactive, portable, object-oriented super high-level language." This is the simplest description of the Python language. As a powerful and universal programming language, Python is widely praised. It has a very clear grammatical characteristics for a variety of operating systems. It is currently very popular internationally and is getting more and more applications.

Python's powerful functionality is:

l Programming language

The Python language can be used as a batch language, write some simple tools, handle some data, as other software interface debugments, etc. The Python language can be used as a function language to develop manually smart programs, with most of the functions of Lisp language. The Python language can be used as a process language, performing our common application development, can be applied as languages ​​such as VB. The Python language can be used as an object-oriented language, with most of the object-oriented language, often developed as a prototype of large application software, rewritten with C , and some directly use Python.

l database

Python is also very excellent in the database, can be connected to a variety of databases, providing data processing, providing support from a commercial database to an open source database. For example: Oracle, MS SQL Server, etc. There are a variety of interfaces to be connected to a database, at least an ODBC. There are many companies that use Python MySQL architecture. Therefore, master Python allows you to make full use of object-oriented features, such as tiger in terms of database processing.

l Windows programming

Python can not only be applied on the UNIX type operating system, but also can have a good performance in the Windows system. By adding a PythonWin module, you can call and build a variety of resources, including calling registry, ActiveX control, and various COM. The most common example is to process the Office document, automatically generate documents and charts through the program.

With Python, you can also generate an EXE application using the Py2exe module. There are many other daily maintenance and management work to be handed over to Python, thereby reducing maintenance workload. With Python, you can also develop a GUI program like VB, VC, Delphi, but can be executed on multiple platforms. This is not inferior to Java in many ways.

l multimedia

With PIL, PIDDLE, REPORTLAB, etc., you can handle images, sounds, videos, animations, etc. to add bright brilliance to your program. Generation of dynamic charts, statistical analysis graphs can be done by Python. In addition, there is OpenGL. With the Pyopengl module, you can write a three-dimensional scene very quickly.

l scientific calculation

Python can extensive a unique role in the scientific calculation field. There are many modules to help you complete your work at high efficiency in calculating giant arrays, vector analysis, neural networks. Especially in education and research, you can have a unique advantage.

l Network programming

Python can complete the work of network programming, providing a number of solutions and modules, which can be very convenient to customize their own server software, whether it is C / S, or B / S mode, has a good solution. .

l graphical user interface

Python can be very convenient to implement the GUI programming, through tkinter, wxpython, Qt, etc., you can write a powerful cross-platform user interface program as needed.

Jython is a Python programming language 100% pure Java implementation [1], which combines the advantages of Python and Java virtual machines and libraries, becoming a useful supplement to the Java platform. The initial Jython is also known as JPython, is a full Java application that allows the syntax and most of the Python programming language. Compared with other programming languages, Jython has the following advantages:

l Python Interpreter Shell's Jython version can make an experiment and research on certain ideas and APIs. Don't have to experience a general Java compilation run cycle.

l Python is designed to be dynamically and universal, so you don't have to add these features by using complex libraries (such as libraries for Java reflections and). This makes it easier to develop, and it is especially useful in the automatic test framework.

l The deployment is simple, providing timely deployment capabilities, no need to spend a lot of time in packaging and compilation cycles.

l Easy to learn and use, low technology threshold, can easily find a lot of users.

JYTHON installation configuration

Jython installation is relatively simple, Jython's installer itself is a Java application, so you must have Java running environments before installation. The following is an example of Jython's latest version Jython2.1, explaining steps of Jython installation steps.

First, make sure the Java running environment on your machine is correct. I am using the operating environment of Windows2000 Server and J2SE1.4. (For the download and installation of J2SE, see http://www.sun.com/downloads);

The official website of Jython http://www.jython.org download Jython's latest version. Select Jython installation file JYTHON-21.CLASS in Jython and Java platform, put it in ClassPath, run Java Jython-21, appear as shown

Select the component you want to install (in the example, I have selected all the default components), accept its license (this is an open source Beopen / CNRI license) and specify the installation directory, and the installer will complete the rest.

转载请注明原文地址:https://www.9cbs.com/read-27054.html

New Post(0)