tags:

views:

181

answers:

2

Hi i am using JPype The following is the code i am trying to use

from jpype import * startJVM("C:\Program Files\Java\jdk1.6.0_14\jre\bin\client\jvm.dll","-ea") java.lang.System.out.println("hai") shutdownJVM()

It is giving error in the execution of the println statement

java.lang.System.out.println("hai") File "", line 1 java.lang.System.out.println("hai") ^ SyntaxError: invalid syntax

Can any body help me please ?? thanks in advance.

A: 

Looks like you might just be missing a semicolon (;)

MatrixFrog
is it neccessary to put semicolon in python?
Rajesh Kumar J
A: 

Firstly, are all the dependencies setup correctly? Java, Python, JPype etc?

You are trying to execute one of the first examples in the documentation.

The sample they provide in the docs are:

from jpype import * 
startJVM("d:/tools/j2sdk/jre/bin/client/jvm.dll", "-ea") 
java.lang.System.out.println("hello world") 
shutdownJVM()

One of the main differences is that you are using \ as a path separator. As per the docs, maybe try a /.

gpampara
Now i change my code to startJVM("C:/Program Files/Java/jdk1.6.0_14/jre/bin/client/jvm.dll","-ea")Still it is giving the same error>>> java.lang.System.out.println("hello world") File "<stdin>", line 1 java.lang.System.out.println("hello world") ^SyntaxError: invalid syntax
Rajesh Kumar J