[Py4j-users] Help Requested: error when accessing jvm for basic sample
Status: Beta
Brought to you by:
barthe
From: Sean S. <sea...@gm...> - 2011-04-19 00:07:21
|
HI All, I'm just getting started with Py4J, basically just trying to call a jar. I'm having trouble with the basic sample however: >>> from py4j.java_gateway import JavaGateway >>> gateway = JavaGateway() # connect to the JVM >>> random = gateway.jvm.java.util.Random() # create a java.util.Random instance >>> number1 = random.nextInt(10) # call the Random.nextInt method >>> number2 = random.nextInt(10) >>> print(number1,number2) (2, 7) >>> addition_app = gateway.entry_point # get the AdditionApplication instance >>> addition_app.addition(number1,number2) # call the addition method 9 I keep getting the following error: [Errno 10061] No connection could be made because the target machine actively refused it I'm on python 2.71 for windows i have jre6 se installed have set path. cheers, Sean |