1

I'm trying to run some python code in real time (as my java code is running) but I keep running into the error below:

SyntaxError: ("mismatched input '.' expecting NEWLINE", ('<>duplicatetesting.py', 11, 43, 'from Python import DuplicateDefectDetection.java\n'))

<> --> the text in here is the path to my python code I've pretty much replicated what was outlined in Accessing Jython from Java Without Using jythonc.

Code:

public interface DuplicateDefectDetection {
public String getRecallRate();
public void setBugsFile(String BugsFile);
public void setDuplicatesFile(String GD);
public void setNumTopics(int numTopics);
public void setCutOff(int cutOff);
public void setRecall(boolean recall);
public void runDuplicateTesting();
}

1
  • You cannot import directly a .java file. You need it compiled first and the resulting class filesomewhere accesible by python (eg.Java's classpath) Commented Jan 24, 2012 at 21:41

1 Answer 1

1

Shouldn't that import be:

from Python import DuplicateDefectDetection

I mean, without the .java part. Also, it has to be a compiled class, accessible from the classpath.

2
  • tried that, got: SyntaxError: ("mismatched input '3' expecting NAME", ('C:/Users/sakmal/Desktop/duplicatedetector/duplicatetesting.py', 14, 6, 'class 3D(DuplicateDefectDetection):\n')) Commented Jan 24, 2012 at 21:54
  • Try with an import declaration like this: from fully.qualified.package import DuplicateDefectDetection Commented Jan 24, 2012 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.