I am unable to load .jar file for my python code, Here is my code for default.py
from quickstart import HelloWorld
import jpype
import os.path
path =os.path.join("/home/nhp06/Documents/Aspose_Cells_java_for_Python/src/lib/aspose-cells-8.6.3.jar")
dataDir = os.path.join(os.path.abspath("./"), "tests/")
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % path)
hw = HelloWorld(dataDir)
hw.main()
shutdownJVM()
And here is my code for init.py
import jpype
class HelloWorld:
def __init__(self,dataDir):
self.dataDir = dataDir
self.Workbook = jpype.JClass("com.aspose.cells.Workbook")
self.FileFormatType = jpype.JClass("com.aspose.cells.FileFormatType")
def main(self):
workbook = self.Workbook()
sheet = workbook.getWorksheets().get(0)
cell = sheet.getCells().get("A1")
cell.setValue("Hello World!")
file_format_type = self.FileFormatType
workbook.save(self.dataDir + "HelloWorld.xls" , file_format_type.EXCEL_97_TO_2003 )
print "Document has been saved, please check the output file.";
When I try to run the above code I get the error
"raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name) jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class com.aspose.cells.Workbook not found"
I am unable to figure this out, why this error occur. I double check my path for .jar file.