在Netbeans 8.0.2和Java 8中使用Apache Tika 1.9会产生巨大的可执行文件.如何减小尺寸? [英] Using Apache Tika 1.9 in Netbeans 8.0.2 and Java 8 produces HUGE executable. What to do to reduce size?

查看:109
本文介绍了在Netbeans 8.0.2和Java 8中使用Apache Tika 1.9会产生巨大的可执行文件.如何减小尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对外部库没有太多运气,所以我只是在使用实用程序的任何项目中都包含了实用程序源.

I haven't had much luck with external libraries, so I've just included the source for utilities in any project that uses utilities.

现在我有一个需要Apache Tika的项目,所以我必须具有类似以下的库设置:

Now I have a project that requires Apache Tika, so I have to have a library setup something like this:

但是要从Netbeans外部运行程序,我显然(按dist文件夹中的readme.txt)需要压缩.jarlib文件夹,解压缩该压缩文件,提取内容,然后从提取到任何地方.

But to run the program from outside Netbeans, I apparently (per readme.txt in dist folder) need to zip the .jar and lib folder, unzip that zipped file, extract the contents, and run from wherever it's extracted to.

但是Tika库为45MB.

But the Tika lib is 45MB.

我只使用了tika-app-1.9.jar库文件中的5个对象:

I only use 5 objects from the tika-app-1.9.jar library file:

import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MimeTypeException;
import org.apache.tika.parser.AutoDetectParser;
import org.apache.tika.sax.BodyContentHandler;

如何将Tika对象的一小部分制作成小于45MB的库?

How do I make a tiny subset of Tika objects into a library that will be a lot smaller than 45MB?

还是我错过了我应该做的事情?

Or am I missing the point of what I SHOULD do?

推荐答案

您应仅包括tika-coretika-parsers组件,这两个文件的大小不得超过1.2MB.

You should only include the tika-core and tika-parsers components, these two files should be no more than 1.2MB.

tika-app jar在主页上的描述如下:

The tika-app jar is described on the home page as this:

Tika应用程序.将上述组件和所有外部解析器库组合到具有GUI和命令行界面的单个可运行jar中.

Tika application. Combines the above components and all the external parser libraries into a single runnable jar with a GUI and a command line interface.

因此它有很多多余的东西,您的应用程序不需要这些东西.

So it has a lot of extra things, which your app does not need.

这篇关于在Netbeans 8.0.2和Java 8中使用Apache Tika 1.9会产生巨大的可执行文件.如何减小尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆