在网站上运行带有 lingpipe 类的 java 程序?
我正在为一个班级开发一个文本分类项目,但在正确设置它时遇到一些困难。我的分类代码是用 Java 编写的,并使用 Lingpipe 工具包中的方法,但我必须从网站运行该程序。我一直在尝试为此目的组合一个 servlet,到目前为止已经下载并设置了一个容器(Tomcat),但我发现在正确的目录中设置所有必要文件的过程很复杂。有没有人对如何从网站运行这样的 Java 程序(无论是否使用 servlet)有任何建议? 谢谢!!!
I am working on a text classification project for a class and I am having some difficulties setting it up correctly. My classification code is in Java and uses methods from the Lingpipe toolkit, but I have to run the program from a website. I've been attempting to put together a servlet for this purpose, and so far have downloaded and set up a container (Tomcat), but I'm finding the process of setting up all the necessary files in the right directories to be complicated. Does anyone out there have any advice as to how to run such a Java program from a website, either using a servlet or not?
Thanks!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理依赖关系和创建 WAR 的最简单方法是使用 Maven。您需要将 lingpipe 库放入本地存储库 /home/{$username}/.m2 。使用 Web 项目原型创建 Maven 项目并将 lingpipe 作为依赖项。对我来说最简单的 Java Web 框架是 play 框架。
The easiest way handle dependencies and create WAR is to use Maven. You need to put lingpipe library into your local repository /home/{$username}/.m2 . Create maven project with web project archetype and put lingpipe as dependency. Easiest java web framework for me is play framework.
您需要将依赖项 jar(包括 LingPipe jar)放入 Web 应用程序的 WEB-INF/lib 目录中。
您自己开发的类,包括 servlet 类,可以打包成 jar 并部署在同一个 WEB-INF/lib 目录中,也可以直接放置在 WEB-INF/classes 目录中(在 Java 的标准 package-as-directory 中)格式 - 例如 com.foo.MyServlet 部署为 WEB-INF/classes/com/foo/MyServlet.class)。
合理的摘要位于 http://tutorials.jenkov .com/java-web-apps/web-app-directory-layout.html。
需要注意的是 - 您可能需要查看 LingPipe 许可证。 LingPipe 曾一度考虑迁移到 AGPL,但显然他们决定不这样做;他们的许可证有点不寻常,其条款可能会影响您的 Web 应用程序部署。
You'll want to put dependency jars (including the LingPipe jar) in the WEB-INF/lib directory of your web application.
Classes you develop yourself, including your servlet class(es) can either be packaged into a jar and deployed in the same WEB-INF/lib directory or placed directly in the WEB-INF/classes directory (in Java's standard package-as-directory format - e.g. com.foo.MyServlet is deployed as WEB-INF/classes/com/foo/MyServlet.class).
A reasonable summary is available at http://tutorials.jenkov.com/java-web-apps/web-app-directory-layout.html.
One caveat - you probably want to look into the LingPipe license. At one point LingPipe considered moving to the AGPL, but apparently they decided not to make that move; their license is a bit unusual, and the terms thereof may affect your web application deployment.