What Is The Interpreter In Python Programming Language?

Interpreter In Python Programming Language The JPython installation places several files on your system, including a set of modules, some sample programs, an application called jpythonc(which we will see later), and the JPython interpreter.

The JPython interpreter looks very similar to the CPython interpreter. However, jpythonis not a binary file, but a short script (or batch file, depending on your system) that invokes your local JVM, sets the Java property install.pathto an appropriate value, and then runs the Java class file org.python.util.jpython.

If you glance at this screen, you might be confused whether JPython or CPython is running because both interpreters do look alike.

If you glance at this screen, you might be confused whether JPython or CPython is running because both interpreters do look alike

The following syntax shows the possible options that you can pass to JPython when invoking it from the shell. A list of options is shown in Table below.

jpython[options][-jar jar|-ccmd|file|-][args]

List of the Interpreter Options and Arguments

List of the Interpreter Options and Arguments

Because jpythonis not a binary executable, but a simple script, you have to add the following line to the top of your JPython programs (only if you have a UNIX system), in order to make them executable.

#!/usr/bin/envjpython

Using something like #!/usr/bin/jpython/jpython will not work because this syntax requires jpythonto be a binary executable (which is not the case).

You also need to make sure that jpython’s directory is registered on your PATH variable. Now let’s take a look at the following code:

classjhello:
def main(argv):
print “Hello Python world!”
myapp=jhello()
myapp.main()

After saving this code in a file, called jhello.py, you can execute it by typing at your OS prompt:

jpython jhello.py