Questions tagged [jython]

Jython is an open-source implementation of the Python programming language in Java. Use this tag for questions specific to this implementation, general Python questions should just be tagged with "python".

Jython is an open-source implementation of the Python programming language written in Java. It is seamlessly integrated with Java, in that it can import and use any Java class. Jython is extensively used as a official scripting language for all WebLogic Server administration tasks.

Jython is also used for administrative scripting for IBM's WebSphere Application Server through the Wsadmin client.

Helpful References

2784 questions
14
votes
4 answers

Are there problems developing Django on Jython?

The background I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative…
Josh Smeaton
  • 47,939
  • 24
  • 129
  • 164
14
votes
2 answers

Jythonc missing

I just installed Jython 2.5.1. I want to convert my Python file into Java class file and it is instructed on the website to use the jythonc command-line tool but I can't find it. Does anyone know where I could find it? Basically what i was trying to…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
14
votes
1 answer

Clojure Jython interop

I was wondering if anyone has tried somehow calling Jython functions from within Clojure, and how you went about doing this if so. I have not used Jython, but I would imagine the Jython interpreter can be invoked in the same way as any other java…
rplevy
  • 5,393
  • 3
  • 32
  • 31
14
votes
1 answer

How can I add jars dynamically to jython, inside script?

I am writing a package in python that talks to an ldap server. I want it to work in CPython and Jython. To get it to work with CPython, I have successfully coded against python-ldap. However, to get it working with Jython, I must use a java jar. How…
gregturn
  • 2,625
  • 3
  • 25
  • 40
14
votes
2 answers

Packaging a Jython program in an executable jar

I am trying to package a jython program into an executable jar which the user can simply double-click to run without installing jython ahead of time. Ultimately, I would like to include an additional library which I wrote with the jar, but at the…
Kyle
  • 280
  • 8
  • 19
14
votes
3 answers

Why must "exec" (and not "eval") be used for Python import statements?

I'm trying to run a snippet of Python from within Java, using Jython. If I use an exec statement to import, everything works. PythonInterpreter pi = new PythonInterpreter(); pi.exec("import re"); PythonObject o = pi.eval("re.match('abc',…
Coderer
  • 25,844
  • 28
  • 99
  • 154
14
votes
5 answers

fast-ish python/jython IPC?

All I want to do is make some RPC calls over sockets. I have a server that does backendish stuff running jython 2.5. I need to make some calls from a frontend server running Django on CPython. I've been beating my head against a wall getting any…
Kobold
  • 1,708
  • 15
  • 17
14
votes
2 answers

Jython, use only a method from Python from Java?

When reading and using this article it assumes that we have a full object definition with class and mapping (proxy) objects from python to java. Is it possible to only import a method (not defined inside a class, but using internal python class)…
user1340802
  • 1,157
  • 4
  • 17
  • 36
13
votes
1 answer

Use a jar in JavaScript through Java ScriptEngine

I need to use classes from a jar file inside JavaScript. I'm using JavaScript through Java ScriptEngine and would like to do something similar to what I did with Jython here, import org.python.core.Py; import org.python.core.PySystemState; …
Kyle Bridenstine
  • 6,055
  • 11
  • 62
  • 100
13
votes
2 answers

Unable to import Java classes from Jython module

Note: I found the solution and answered myself. Though, I have no idea why that setting was wrong and caused the problem. I'm still interested in having a good explanation about how Jython import system works; if anyone cares to gain the bounty…
Paolo
  • 20,112
  • 21
  • 72
  • 113
12
votes
2 answers

Why is my file getting closed if I don't do anything with it for a while?

Original situation: The application I'm working on at the moment will receive notification from another application when a particular file has had data added and is ready to be read. At the moment I have something like this: class Foo(object): …
Cam Jackson
  • 11,860
  • 8
  • 45
  • 78
12
votes
4 answers

Parsing Command line arguments in python which has spaces

I am invoking the script from ant . I am getting it as a single string from the caller but python is strangely treating it as two individual strings.I have script that reads a file name with it's path in windows. The folder structure may or may not…
Raj
  • 1,250
  • 2
  • 11
  • 20
12
votes
4 answers

Can I run numpy and pandas with Jython

We have some Java code we want to use with new code we plan to write in Python, hence our interest in using Jython. However we also want to use numpy and pandas libraries to do complex statistical analysis in this Python code. Is it possible to…
user2895685
  • 121
  • 1
  • 1
  • 3
12
votes
3 answers

Why does Jython refuse to find my Java package?

I know it's something silly, but for some reason Jython refuses to find javax.swing. I'm using Java 1.6.0_11. This is my start-up script: @echo off "%JAVA_HOME%\bin\java" -Xmx1024M -classpath ".;c:\Projects\Jython2.5.1\jython.jar"…
MikeHoss
  • 1,477
  • 4
  • 18
  • 35
11
votes
2 answers

Java file permissions for threads

I'm programming a Java server that has to handle Python code given by the user using Jython. Obviously, I can't just execute it without some risk of a cracker accessing files and system commands that he/she shouldn't. I've been searching for some…
ConsciousCode
  • 563
  • 4
  • 18