如何使用Netbeans IDE 8.0为Web应用程序创建jar文件 [英] How to create a jar file for a web application using Netbeans IDE 8.0

查看:270
本文介绍了如何使用Netbeans IDE 8.0为Web应用程序创建jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JAVA平台上使用Netbeans IDE 8.0做了一个Web应用程序。该项目由JSP,Servlets和普通的.java文件组成。我想将项目作为一个简单的jar文件部署到客户端,以便他们可以执行jar文件并使用该应用程序。我试图使用给定资源的Netbeans生成jar文件,但没有适当的资源。当我尝试使用其中一个源时,会创建一个war文件而不是一个jar文件。

I did a Web Application using Netbeans IDE 8.0 in JAVA platform. The project consists of JSP's, Servlets and normal .java files. I would like to deploy the project as a simple jar file to the client so that they can execute the jar file and use the application. I am trying to generate jar file using Netbeans with the given resources but there were no proper resources for this. When I tried one of the sources provided, a war file is created rather than a jar file.

所以,请帮助我将我的Web应用程序转换为jar文件。另外,请让我知道为什么为我的应用程序而不是jar文件创建war文件。另外,让我知道如何执行war文件。

So, please help me in converting my web application into a jar file. Also, please let me know why a war file is created for my application rather than a jar file. Also, let me know how to execute war file.

推荐答案

Java应用程序使用jar文件,java web应用程序使用war文件。 JAR(Java ARchive)是一种包文件格式,通常用于将许多Java类文件和关联的元数据和资源(文本,图像等)聚合到一个文件中,以在Java平台上分发应用程序软件或库。 WAR文件(Web应用程序ARchive)是一个JAR文件,用于分发JavaServer Pages,Java Servlet,Java类,XML文件,标记库,静态网页(HTML和相关文件)以及共同构成Web应用程序的其他资源的集合。由于Web应用程序的结构与典型的Java独立应用程序非常不同,因此您需要将其部署到war文件中。要运行WAR文件,您需要一个基于Java EE的服务器,如apache tomcat,jboss,glassfish等。运行war文件所需的步骤是(可能的解决方案之一,尽管还有许多其他的 - 由boris指出): -

Java applications use jar files and java web-applications use war files. JAR (Java ARchive) is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file to distribute application software or libraries on the Java platform. WAR file (Web application ARchive) is a JAR file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries, static web pages (HTML and related files) and other resources that together constitute a web application. Since the structure of a web application is very much different from a typical java standalone application you need to deploy it into a war file. To run a WAR file you need a java EE based server like apache tomcat, jboss, glassfish etc. Steps required to run the war file are (One of the solutions possible, although there are many other -as pointed out by boris):-

1.启动Web服务器;

1.Start the web server;

2.将war文件部署到Web服务器;

2.Deploy the war file to the web server;

3.通过输入指向其路径的链接,在浏览器中访问JSP页面或servlet。

3.Visit JSP pages or servlets in the browser by entering thier links to their path.

请参阅此链接有关部署战争的更多详细信息: - 在tomcat服务器中部署war文件

see this link for more details on deploying war :- deploy war file in tomcat server

这篇关于如何使用Netbeans IDE 8.0为Web应用程序创建jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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