Here you can find the source of loadJCC()
public static void loadJCC() throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void loadJCC() throws Exception { String base = getJCCPath("python"); String library = base + "/libjcc.so"; System.load(library);/* w w w . ja v a2 s . c o m*/ } /** * Runs Python in the console and retrieves the location of the JCC egg * * @return * @throws Exception */ public static String getJCCPath(String pythonExec) throws Exception { String[] cmd = { pythonExec, "-c", "import os, jcc; print os.path.dirname(os.path.dirname(jcc.__file__))" }; return execCommand(cmd); } public static String execCommand(String[] cmd) throws Exception { Runtime run = Runtime.getRuntime(); Process pr = null; try { pr = run.exec(cmd); } catch (IOException e) { e.printStackTrace(); throw e; } try { pr.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); throw e; } BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line = null; StringBuffer out = new StringBuffer(); try { while ((line = buf.readLine()) != null) { out.append(line); out.append("\n"); } } catch (IOException e) { e.printStackTrace(); throw e; } return out.toString(); } }