Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: java Tomcat

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question java Tomcat

    Hi all,
    I am trying to create an android app that connects to a server and gets some data,
    I have a simple android client and a server in Java. I have been working on it localy, on my own pc using and android emulator.
    Now i would like to get it on line, so ppl can start testing it. The problem is how to set my server online.
    after 2 days of pocking around, i realised that i need a war file. So i installed Ant and Tomcat on Eclipse.
    I created the build.xml for ant, and I think i properly created a jar file when i run ant.
    My problem is that i cant get it to WAR. From what i have read, i need a war to get tomcat properly up and running, but when i try to export the project from eclipse to WAR it doesnt give me the option to choose my project.

    Any help?
    Thanks in advance, ilias


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java Tomcat

    Does eclipse know that your project is a web application? In other words, when you created the project, did you create is as a web application or something else?

    You either need to create it as a web application, or use something like ant or maven to do the building for you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Aug 2014
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: java Tomcat

    I didnt create a web application. just a normal java project. But as i mentioned, i used ant, so that should do it, right?

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java Tomcat

    That depends. Do you have an ant task that creates a .war file?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Aug 2014
    Posts
    29
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: java Tomcat

    Hmmm, i am not sure. I do have ant, but it created a jar not a war file.
    Is ant task something different than just ant?

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java Tomcat

    Ant tasks tell ant what to do. How are you using ant without a task? You probably have a "jar task", when you really need a "war task". Recommended reading: https://ant.apache.org/manual/Tasks/war.html

    Or you could just set eclipse up to create a way by creating a web application project instead of a Java project. Up to you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7

    Default Re: java Tomcat

    Apache Tomcat is a webcontainer which allows to run servlet and JavaServer Pages (JSP) based web applications. Most of the modern Java web frameworks are based on servlets, e.g. JavaServer Faces, Struts, Spring.

  8. #8
    Member
    Join Date
    Sep 2018
    Posts
    32
    Thanks
    0
    Thanked 9 Times in 6 Posts

    Default Re: java Tomcat

    Apache Tomcat is used to deploy your Java Servlets and JSPs. So in your Java project you can build your WAR (short for Web ARchive) file, and just drop it in the deploy directory in Tomcat. So basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.

Similar Threads

  1. Tomcat 7.0.27
    By find in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: August 15th, 2014, 12:16 PM
  2. Tomcat
    By chin launch in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 27th, 2014, 06:45 AM
  3. How to link .java code in eclipse to tomcat
    By shenaz in forum Java Theory & Questions
    Replies: 0
    Last Post: April 1st, 2013, 11:54 AM
  4. Replies: 0
    Last Post: January 28th, 2013, 05:29 AM
  5. java servlet(tomcat v7.0)
    By aman_chauhan in forum Java Servlet
    Replies: 6
    Last Post: August 5th, 2012, 07:45 AM

Tags for this Thread