Skip to content
Nathan Jensen edited this page May 26, 2015 · 19 revisions

Since Jep 3.0

##Building Jep If you cloned or downloaded the Jep source, you will need to build Jep. Simply run

python setup.py build

If the build succeeds it will create a directory jep/build which will contain a jep.jar and the compiled C library of Jep, typically named jep.so or jep.dll depending on your platform.

##Installing Jep There are multiple ways to install Jep, sorted in order of least involved to most involved:

  1. If you used pip install jep, Jep should already be built and installed.
  2. If you built the source yourself, you can run python setup.py install to install Jep to the standard dirs.
  3. If you would like to include jep as part of your application, you can place the files as necessary presuming the following conditions are met:
  • The jep.jar is accessible to the Java classloaders (typically through the Java classpath)
  • The shared library (jep.so or jep.dll) is accessible by the Java process (typically through -Djava.library.path or the environment variable LD_LIBRARY_PATH)
  • The jep python files (hook.py, version.py, etc) are accessible by Python (typically by placing them in the site-packages/jep directory).

##Example Code Using Jep in your application is designed to be easy to intermix Java and Python objects.

try(Jep jep = new Jep(false)) {
    jep.eval("from java.lang import System");
    jep.eval("s = 'Hello World'");
    jep.eval("System.out.println(s)";
    jep.eval("print(s[1:7])");
}
Clone this wiki locally