Hallo,
ich habe mir jython2.2.1. installiert. Anschließend habe ich mir registry-Datei angepasst.
Dieses Python Programm (hello.py)
habe ich mit jythonc kompiliert:
Nach dem kompilieren wollte ich es wie folgt starten:
aber leider bekomme ich diese Fehler. Wie bekomme ich es zum laufen?
Viele Grüße
ich habe mir jython2.2.1. installiert. Anschließend habe ich mir registry-Datei angepasst.
Code:
# Python Registry -*- ksh -*-
# This default registry sets many common options to their default values
# All of these settings could be erased with no change in behavior
# This is how Jim sets his path on his Windows development machine
#python.path=.;c:\\Jython\\Lib;d:\\Python-1.5.2\\Lib
# This is how Barry sets his path on his Unix development machine
#python.path = /home/bwarsaw/projects/python/Lib
# This is how Finn sets his path on his windows development machine
#python.path = d:\\python20\\lib
# Set the directory to use for caches (currently just package information)
# This directory should be writable by the user
# If this is an absolute path it is used as given
# Otherwise it is interpreted relative to sys.prefix
# (typically the directory of this file)
python.cachedir = cachedir
# Setting this property to true disables the package scan for the cachedir.
# Please be aware that disabling this might break some java import statements
#python.cachedir.skip = false
# Properties to check for initializing and updating the package cache
# Hopefully you won't have any need to change these
python.packages.paths = java.class.path, sun.boot.class.path
python.packages.directories = java.ext.dirs
# To force JIT compilation of Jython code -- should be unnecessary
# Setting this to true will cause jdk1.2rc1 to core dump on Windows
python.options.compileClass = false
# Set verbosity to error, warning, message, comment, or debug
# for varying levels of informative messages from Jython. Normally
# this option is set from the command line.
#python.verbose = message
# Setting this to true will support old 1.0 style keyword+"_" names
# This isn't needed any more due to improvements in the parser
python.deprecated.keywordMangling = false
# Setting this to the name of different console class, new console
# features can be enabled. Readline support is such an example
#python.console=org.python.util.ReadlineConsole
#python.console.readlinelib=JavaReadline
# Setting this to true will cause the console to poll standard in
# This might be helpful on systems without system-level threads
python.console.poll = false
# Setting this to a valid codec name will cause the console to use a
# different encoding when reading commands from the console.
# The default java encoding is still used when reading python sources
# from the filesystem.
#python.console.encoding = cp850
# Setting this to false will allow Jython to provide access to
# non-public fields, methods, and constructors of Java objects.
python.security.respectJavaAccessibility = true
# List of choices for internal tables impl (PyJavaClasses canonical map etc.),
# these are separated through ':' and tryed from left to right.
# For long running applications under java2, needing classes unloading,
# in order to have jython runtime automatically discarding
# no longer needed info and avoding memory leakage, this can be set
# to weak or soft (=> an impl. using weak-refs or soft-refs will be used).
#python.options.internalTablesImpl = soft
#python.options.internalTablesImpl = weak
# Setting this to true will force Jython will use the first module
# found on sys.path where java File.isFile() returns true.
# Setting this to true has no effect on unix-type filesystems.
# On Windows/HPS+ systems, setting it to true will enable Jython-2.0
# behaviour.
python.options.caseok = false
# Use this registry entry to control the list of builtin modules; you
# can add, remove, or override builtin modules. The value for this
# registry key is a comma separated list of module entries, each entry
# of which has the following allowable forms:
#
# name
# The module name is `name' and the class name is
# org.python.modules.name
#
# name:class
# The module name is `name' and the class name is `class' where
# class must be a fully qualified Java class name
#
# name:null
# The module `name' is removed from the list of builtin modules
#
# A good example would be to use a jni version of os for more
# functionality by having an entry such as os:com.foo.jni.os
#python.modules.builtin = whatever
# This specifies the command used by jythonc to compile Java source
# code, along with the complete classpath to use.
# python.jythonc.compiler = /depot/java/plat/bin/jikes
# python.jythonc.classpath = /usr/java1.2/jre/lib/rt.jar:/Jython/dist:.
# python.jythonc.compileropts = +E +D -g
python.jythonc.compiler = /opt/jdk1.6.0_06/bin/javac
python.jythonc.classpath = /opt/jdk1.6.0_06/jre/lib/rt.jar:/Jython/dist:.
#python.jythonc.compileropts = +E +D -g
# python.environment controls the type of environment support provided
# by the os module. Default behavior for known operating systems is to
# generate the environment by executing shell commands appropriate to
# the operating system. For unknown operating systems, provide an
# empty environment. Uncomment this line for an empty environment
# on all operating systems.
#python.environment=None
# python.os determines operating-specific features, similar to and overriding the
# Java property "os.name".
# Some generic values are also supported: 'nt', 'dos', 'mac' and 'posix'.
# Uncomment the following line for the most generic OS behavior available.
#python.os=None
Dieses Python Programm (hello.py)
Code:
print "Hello"
habe ich mit jythonc kompiliert:
Code:
$ jythonc hello.py
Warning: jythonc is unmaintained and will not be included in Jython-2.3. See [url]http://jython.org/Project/jythonc.html[/url] for alternatives to jythonc. Add '-i' to your invocation of jythonc to turn off this warning
processing hello
Required packages:
Creating adapters:
Creating .java files:
hello module
Compiling .java to .class...
Compiling with args: ['/opt/jdk1.6.0_06/bin/javac', '-classpath', '/opt/jdk1.6.0_06/jre/lib/rt.jar:/Jython/dist:.:/home/mitlox/jython2.2.1/jython.jar:./jpywork::/home/mitlox/jython2.2.1/Tools/jythonc:/home/mitlox/jython2.2.1/Lib:__classpath__', './jpywork/hello.java']
0
Nach dem kompilieren wollte ich es wie folgt starten:
Code:
$ cd jpywork/
$ java hello
Exception in thread "main" java.lang.NoClassDefFoundError: org/python/core/PyObject
Caused by: java.lang.ClassNotFoundException: org.python.core.PyObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Viele Grüße