Search code examples
javaeclipsewar

Why there is no WAR file under my Java project upon export?


I am trying to build my project using the WAR in Java, but it is not visible upon exporting, I can't find the same problem as mine. Does anyone encountered this issue and how did you resolved?

Please see image below

enter image description here


Solution

  • Please make sure your Java application contains the correct file structure so the JDK can generate a WAR file. It should contains the WEB-INF folder

    Structure of a Web App in Java (Screenshot obtained from https://courses.ischool.berkeley.edu/i290-8/s04/lectures/10/tomcat-cocoon/slide12.html

    Also, please check if you setup accordingly the Java Development Kit (JDK) in Eclipse instead of the JRE.

    Just to make sure this issue it is not occurring because some misconfiguration with Eclipse, you can also try to generate the war file:

    1. Open cmd or any console you are using.
    2. Go inside the project directory of your project (outside the WEB-INF)
    3. Run the below command:

    jar -cvf appname.war *

    where -c is used to create file, -v to generate the verbose output and -f to specify the file name.