Hi can anyone please tell me how to convert the eclipse dynamic web app into executable jar. I need to use this jar in another application to generate the jsps. So even after adding into another project it should be working as web app only.
Can anyone please help me to resolve this.
For Dynamic web projects you cannot create an Executable jar file,but you always have an option to export as .War file that you can include to build and EAR file which can include multiple .war files from other Dynamic web applications as well. How this war can communicate with other war files with in EAR for that you can refer this Options to communicate between WARs in the same EAR
Related
I have a java project that use tomcat. when I run project in idea with tomcat(version 6)my project run in idea and in tomcat not create web inf file for my project and war file. why?
thanks
It should be a web project not java project and Tomcat is not responsible for creating web-inf folder. It is created when you first defined the project. Also are you able to see your war after building ? Does it launch the browser when you say running in Tomcat?
I saw lots of questions including this one : How to create an war file in Eclipse without ant or maven?
I have standard web project created with eclipse. In this web project like many others there isn't only jsp and web files, but java files also. I am using eclipse Luna and I am trying to export my project as war but when I use the export option and package it like war it packages only my web content. Normally after I deploy it to tomcat it fails on login in my site because there is no java files on the war. I am new to the web projects and I do not want to use maven or ant. I want to just simply make working war from eclipse and could not find normal way to do that.
Right Click on your Web project --> export --> War file --> Choose destination path and select on Export source files.
See the below screen shot:
After creating Excel2DB22.war. I have imported it again into my IDE. I can see all the files including java also in that project.
See the below SS:
I hope it will help you.
I have a WAR file which contains some web application.
I have created a new java web application and i want to use some classes of the WAR which i already have.
How to add the WAR file as a dependency in my new Java Web Application in using eclipse.
I am running this application in Tomcat 7.0 server.
Thanks & Regards,
Rahul
A WAR file is not intended as a dependency, it has a structure specifically designed for deployment to application servers (that understand that structure).
I would move the classes you want to depend on into a separate jar and then have both the war project and your new project depend on it.
You could also create a client jar from the war project which your new application could depend on. However, if you go down the maven route, the Sonatype tutorial will say that each maven project should only produce one artifact.
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.
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 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.Start the web server;
2.Deploy the war file to the web server;
3.Visit JSP pages or servlets in the browser by entering thier links to their path.
see this link for more details on deploying war :- deploy war file in tomcat server
Can anyone guide me how to get Servlets working in Apache Tomcat server? I can run the Servlets from Netbeans without problems, but I don't know where to put the class files in Tomcat.
In tomcat:
class files must be in TOMCAT_DIR/webapps/<yourAppName>/WEB-INF/classes
jar files must be in TOMCAT_DIR/webapps/<yourAppName>/WEB-INF/lib
(and if course you'll need web.xml in WEB-INF)
They go in Tomcat/webapps folder. There are several ways to deploy a JSP/Servlet webapplication on Tomcat. They are all described in Tomcat Web Application Deployment HOW-TO.
If you already have developed the webapplication in Netbeans, then Netbeans should already have build a WAR file of it in the /dist folder. You just need to drop the WAR file in Tomcat/webapps folder and Tomcat will automatically deploy it during startup (or even while running, this is called hotdeploy).
If you want to develop without an IDE and/or don't want to create a WAR, then you just need to put a folder representing the context name in Tomcat/webapps, e.g. Tomcat/webapps/contextname. It will become the public web content. You can drop all JSP files and other static files in there. Then, for classes you need to create a Tomcat/webapps/contextname/WEB-INF/classes folder. There should go the package structure.