jythonc problem

Status
Nicht offen für weitere Antworten.

flashdog

Bekanntes Mitglied
Hallo,
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)
aber leider bekomme ich diese Fehler. Wie bekomme ich es zum laufen?

Viele Grüße
 

flashdog

Bekanntes Mitglied
Leider klappte es so nicht:

Code:
$ java -cp /home/flashdog/jython2.2.1/jython.jar hello 
Exception in thread "main" java.lang.NoClassDefFoundError: hello
Caused by: java.lang.ClassNotFoundException: hello
        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)

Aber leider bekomme ich immer noch Fehler. Woran kann es liegen?
 

HoaX

Top Contributor
weil jetz hello nichtmehr im classpath ist

-> java -cp /home/flashdog/jython2.2.1/jython.jar:. hello
 

flashdog

Bekanntes Mitglied
Danke, es funktioniert.

Ist es möglich jythonc so zu konfigieren, dass man nach dem kompilieren nicht mehr jython.jar benötigt oder zumindestens die größen von jython.jar zu reduzieren, d.h. nur das was man wirklich benötigt?
 

flashdog

Bekanntes Mitglied
Habe es geschafft von 1,1 MB auf 0,6 MB zu reduzieren mit
Code:
jythonc -c -j myjar.jar hello.py
java -jar myjar.jar

Hier steht ( http://www.jython.org/applets/ ) das es moeglich ist auf 200 K zu reduzieren, aber leider habe ich keine Ahnung wie man es schaffen kann.
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
C Problem mit Spring Boot Dependency Injection Java Basics - Anfänger-Themen 12
R Best Practice Problem mit (einfacher) Doppelt-Schleife Java Basics - Anfänger-Themen 53
K Verständnis Problem bei Server/Client Java Basics - Anfänger-Themen 2
I WildFily - unterschiedliche Libs im Projekt verursachen Problem Java Basics - Anfänger-Themen 11
imocode Vererbung Problem mit Vererbung Java Basics - Anfänger-Themen 2
L Taschenrechner Problem Java Basics - Anfänger-Themen 4
I Applikationsserver (WildFly) - Zugriff auf Ressourcen.. Problem mit Pfade Java Basics - Anfänger-Themen 10
A ScheduledExecutorService problem Java Basics - Anfänger-Themen 7
marcelnedza Problem mit Weltzuweisung, JavaKarol Java Basics - Anfänger-Themen 13
XWing Methoden rückgabe Problem? Java Basics - Anfänger-Themen 6
M Erste Schritte Collatz Problem max int Java Basics - Anfänger-Themen 3
M Problem bei verschachtelter for-Schleife bei zweidimensionalen Arrays Java Basics - Anfänger-Themen 3
C GLOOP Problem beim Erstellen der Kamera Java Basics - Anfänger-Themen 9
nelsonmandela Problem bei Ausgabe einer Switch - Case Funktion Java Basics - Anfänger-Themen 5
frager2345 Problem mit Methode Java Basics - Anfänger-Themen 4
L Problem bei Rechnung mit Math.pow Java Basics - Anfänger-Themen 13
A Thread-Schreibe-Lese-Problem Java Basics - Anfänger-Themen 4
SUPERTJB return Problem Java Basics - Anfänger-Themen 3
sserio BigInteger Problem Java Basics - Anfänger-Themen 4
JordenJost Taschenrechner problem Java Basics - Anfänger-Themen 5
K Problem mit "Random" Java Basics - Anfänger-Themen 5
S Datei anlegen Problem! Groß- und Kleinschreibung wird nicht unterschieden Java Basics - Anfänger-Themen 4
sserio Problem beim Anzeigen Java Basics - Anfänger-Themen 5
xanxk Problem For-Schleife mit Charakter Java Basics - Anfänger-Themen 2
L Unbekanntes Problem mit 2d Array Java Basics - Anfänger-Themen 6
sserio Liste erstellt und ein Problem mit dem Index Java Basics - Anfänger-Themen 8
sserio Schwimmen als Spiel. Problem mit to String/ generate a card Java Basics - Anfänger-Themen 4
J Schleife Problem Java Basics - Anfänger-Themen 2
D Problem mit der Erkennung von \n Java Basics - Anfänger-Themen 2
milan123 das ist meine aufgabe ich hab das problem das bei mir Wenn ich die Richtung der Linien verändern will und drei davon sind richtig, verändere ich die 4 Java Basics - Anfänger-Themen 3
M Verständins Problem bei Aufgabe Java Basics - Anfänger-Themen 4
HeiTim Problem mit der Kommasetzung an der richtigen stelle Java Basics - Anfänger-Themen 59
Temsky34 Problem mit dem Code Java Basics - Anfänger-Themen 17
P Problem mit Calendar.getDisplayName() Java Basics - Anfänger-Themen 8
C Problem mit mehreren Methoden + Scanner Java Basics - Anfänger-Themen 5
P Datei einlesen, nach Begriff filtern und in Datei ausgeben. Problem Standardausgabe über Konsole Java Basics - Anfänger-Themen 19
M Problem mit Klassenverständnis und Button Java Basics - Anfänger-Themen 8
EchtKeineAhnungManchmal hallo habe ein Problem mit einer Datei -> (Zugriff verweigert) Java Basics - Anfänger-Themen 4
H Problem mit Verzweigungen Java Basics - Anfänger-Themen 6
H Problem mit Rückgabewert Java Basics - Anfänger-Themen 7
josfe1234 JAVA FX problem Java Basics - Anfänger-Themen 3
A Code Problem Java Basics - Anfänger-Themen 6
Henri Problem von Typen Java Basics - Anfänger-Themen 7
J Problem mit "ArrayIndexOutOfBoundsException" Java Basics - Anfänger-Themen 11
K jackson Mapping - Problem mit Zeitzonen Java Basics - Anfänger-Themen 10
B Threads Problem mit mehreren Threads Java Basics - Anfänger-Themen 38
I Output BigDecimal anstatt double / Problem beim Rechnen Java Basics - Anfänger-Themen 16
D Schleifen Problem Java Basics - Anfänger-Themen 2
H So viele Fehlermeldungen, dass ich nicht weiß wo das Problem ist. Java Basics - Anfänger-Themen 6
J JAVA-Problem blockiert MEDIATHEKVIEW Java Basics - Anfänger-Themen 13
T Problem mit Lehrzeichen und String bei einfacher Chiffre Java Basics - Anfänger-Themen 8
J extends Problem Java Basics - Anfänger-Themen 2
C Polymorphie-Problem Java Basics - Anfänger-Themen 3
Kalibru Problem bei Ausgabe von Objekt Java Basics - Anfänger-Themen 1
I Format Problem mit Wert - bekomme 0,10 anstatt 10,00 Java Basics - Anfänger-Themen 6
J Problem mit einer Methode die gewissen Inhalt einer Array löschen soll Java Basics - Anfänger-Themen 9
J Problem mit einer Methode, die beliebig viele Objekte in Array speichern soll Java Basics - Anfänger-Themen 6
J Allgemeines Problem mit Klassen Java Basics - Anfänger-Themen 5
U Problem mit dem initialisieren meines Strings in einer Schleife Java Basics - Anfänger-Themen 5
amgadalghabra algorithmisches Problem Java Basics - Anfänger-Themen 19
J Traveling Salesman Problem [Arrays] Java Basics - Anfänger-Themen 9
R ArrayList Problem Java Basics - Anfänger-Themen 6
InfinityDE Problem mit Datenübergabe an Konstruktor Java Basics - Anfänger-Themen 7
C RegEx Problem Java Basics - Anfänger-Themen 4
J Anfänger TicTacToe, Problem bei Gewinnoption, sowohl Unentschieden Java Basics - Anfänger-Themen 8
E Taschenrechner GUI Problem mit Fehlerhandling Java Basics - Anfänger-Themen 6
M Input/Output Fallunterscheidung Problem Java Basics - Anfänger-Themen 17
P Problem beim Überschreiben einer vererbten Methode Java Basics - Anfänger-Themen 4
M Problem bei Ausgabe Java Basics - Anfänger-Themen 7
Splayfer Java Array Problem... Java Basics - Anfänger-Themen 2
G Problem bei der Ausgabe einer Main Claase Java Basics - Anfänger-Themen 7
F Problem mit KeyListener in kombination mit dem ActionListener Java Basics - Anfänger-Themen 4
G Subset sum problem mit Backtracking Java Basics - Anfänger-Themen 18
N Problem mit Scanner Java Basics - Anfänger-Themen 2
J Klassen Problem Java Basics - Anfänger-Themen 8
A Out.format problem. Java Basics - Anfänger-Themen 3
J Problem bei der Programmierung eines Tannenbaums Java Basics - Anfänger-Themen 9
A Array problem Java Basics - Anfänger-Themen 16
2 Taschenrechner mit GUI Problem bei der Berechnung Java Basics - Anfänger-Themen 8
W Remote Method Invocation RMI - Problem Java Basics - Anfänger-Themen 0
I Ich habe ein Problem Java Basics - Anfänger-Themen 3
A Problem bei returnen eines Wertes Java Basics - Anfänger-Themen 6
M Regex Erstellung Problem Java Basics - Anfänger-Themen 2
D Input/Output Problem bei der Benutzereingabe eines Befehls Java Basics - Anfänger-Themen 14
M (Sehr großes Problem) Listen als static in anderen Klassen verwendet Java Basics - Anfänger-Themen 12
F Habe ein problem mit dem ActionListener Java Basics - Anfänger-Themen 3
C Regex-Problem Java Basics - Anfänger-Themen 4
J Problem beim vergleich von zwei Integer Java Basics - Anfänger-Themen 3
M Problem in der Modellierung Java Basics - Anfänger-Themen 20
W Wo ist das URL-Problem ? Java Basics - Anfänger-Themen 1
S Generics-Problem: Class, Class<?>, Class<Object> Java Basics - Anfänger-Themen 4
D FileWriter / FileReader Problem Java Basics - Anfänger-Themen 10
G Problem beim Speichern von Objekten in einer Datei Java Basics - Anfänger-Themen 7
S Compiler-Fehler Exception in thread "main" java.lang.Error: Unresolved compilation problem: Java Basics - Anfänger-Themen 6
J Problem mit Array: 2 Klassen Java Basics - Anfänger-Themen 2
S Collections funktionale Listen (ListNode<E>) review und problem beim clone Java Basics - Anfänger-Themen 0
W OOP Vererbung und Problem bei Zählschleife in einer Methode Java Basics - Anfänger-Themen 10
C Problem mit If Else If und Überprüfung eines Counters Java Basics - Anfänger-Themen 3
F Problem mit Listen Java Basics - Anfänger-Themen 5
I wieder mit einer Umwandelung habe ich Problem (diesmal von char Array zu char) Java Basics - Anfänger-Themen 1

Ähnliche Java Themen


Oben