I'm trying out jython, and got stuck pretty early with the example from chapter 10 http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html the math import does work from the java library. But I cannot get the custom class Beach to work.
I saw an identical post Jython won't import user-defined class; ImportError: No module named ****** However I did not understand the accepted answers approach.
So I'm hoping for a bit clarification.
Below is my project structure.
import Beach
b = Beach("Cocoa Beach","Cocoa Beach")
print (b.getName(Beach.getName()))
import Beach: Unresolved import: Beach
EDIT: Got it working with the following:
import sys
sys.path.append('C:\Users\Rasmus\Desktop')
import Beach
beach = Beach("Cocoa Beach","Cocoa Beach")
beach.getName()
print(beach.getName())
However pydev eclipse still marks import Beach as an unresolved import.
The Beach class
public class Beach {
private String name;
private String city;
public Beach(String name, String city){
this.name = name;
this.city = city;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}