You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用tabula-py读取PDF时遇java.lang.ClassNotFoundException: org.apache错误求助

使用tabula-py读取PDF时出现org.apache类找不到的错误

我尝试用Python的tabula-py读取PDF文件但未成功。已安装Java的jre-1.8和jdk-20版本,配置了JAVA_HOME路径(路径为C:\Program Files\Java\jre-1.8\bin)并添加至Path环境变量,但运行read_pdf方法仍报错。

我的代码如下:

import pandas as pd

from tabula import read_pdf
from tabulate import tabulate

file_name: str = "to_tabulate.pdf"

df = read_pdf(file_name)

print(tabulate(df))

精简后的报错信息:

Exception                                 Traceback (most recent call last)
File org.jpype.JPypeContext.java:-1, in org.jpype.JPypeContext.callMethod()

Exception: Java Exception

The above exception was the direct cause of the following exception:

java.lang.ClassNotFoundException          Traceback (most recent call last)

...

java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: org.apache

The above exception was the direct cause of the following exception:

...

ImportError: Failed to import 'org.apache'

我找不到针对该问题的解决方案,也完全不清楚原因(我无Java使用经验,仍处于Python入门阶段)。注意到报错栈中仅提及org.apache,未附带子类(如commons)。

有没有人遇到过类似问题?有什么解决方案吗?非常感谢您的帮助。

环境信息:

  • Windows 11 Pro 22H2 22621.2134
  • Python 3.11.1
  • tabula-py 2.8.1

内容的提问来源于stack exchange,提问作者Soren V. Raben

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 08:47:08