JPype is an effort to allow python programs full access to java class libraries. This is achieved not through re-implementing Python, as Jython/JPython has done, but rather through interfacing at the native level in both Virtual Machines.
first: bulid a file of .java----HelloWorld
#####################################
package my;
public class HelloWorld
{
/** Creates a new instance of HelloWorld */
public HelloWorld()
{
}
public void message()
{
System.out.println("Hello, World");
}
public static void do_a_message()
{
System.out.println("Static Hello, World");
}
}
#####################################
second:compile .class and .jar ---------DOS----->the father-directory of the package"my"
#############
jar cf test.jar my
#############
last: bulid Test.py
########################################
from jpype import *
startJVM(getDefaultJVMPath(),"-Djava.class.path=C:/test.jar")
HelloWorld = JPackage('my').HelloWorld
mm=HelloWorld()
mm.message()
shutdownJVM() ## noted
##########################################