TLive TLive - 1 year ago 84
Java Question

Converting Jython code into a Java Class

Goal: allow end users to write jython scripts that will create AI objects [for controlling fleets of spaceships in a game] in Java.

I want the user to be able to write all the logic for the AI in a .py file then convert that code into a java object. I would like to do this without using Java reflection and without running the user's code through an interpreter every time it is needed. The whole point of this is to make the code run as fast as possible, because the AI logic will have to run every game loop.

I've seen Jython's

method, but I don't really understand how to use it or if it is what I need.

I would greatly appreciate any insight into a good solution to my problem, or knowledge about
. I am committed to both Java and Jython, so suggesting alternatives is not productive :)

Answer Source

You should have a look at these ways to use jython code from a java application.

You should write you code in jython and use it, as it is, in your Java application with a little effort.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download