问题
I am trying to use tabula-py to convert pdfs into tables when I run the following command
x=tabula.read_pdf("/Users/Rexon/PycharmProjects/UNFCCC_pdftocsv/Australia Data.pdf", output_format='Dataframe')
This is the error message
Exception in thread "main" java.lang.UnsupportedClassVersionError: technology/tabula/CommandLineApp : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tabula/wrapper.py", line 75, in read_pdf
output = subprocess.check_output(args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['java', '-jar', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tabula/tabula-1.0.1-jar-with-dependencies.jar', '--pages', '1', '--guess', '/Users/Rexon/PycharmProjects/UNFCCC_pdftocsv/Australia Data.pdf']' returned non-zero exit status 1
回答1:
From the comments the solution was to upgrade Java from 1.6 to 1.8.
来源:https://stackoverflow.com/questions/48566577/tabula-py-calledprocesserror-command-java-jar