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 3 of 3

Thread: How to run an example servlet? Using- Netbeans7 & Tomcat6, OS=Ubuntu 10.10, linux 2.6

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    26
    My Mood
    Fine
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Question How to run an example servlet? Using- Netbeans7 & Tomcat6, OS=Ubuntu 10.10, linux 2.6

    Hi!

    I'm learning to use servlets using Netbeans7 and Tomcat6 on a linux machine(Ubuntu 10.10). I have created a user in tomcat with manager,admin,tomcat and role1 roles. I added the Java EE 6 API library in my default project in netbeans and wrote the code for simple "hello world" servlet. Now I have book that suggests copying the compiled .class file to the folder which contains the class files for other default examples and then use it's address as URL in a html file. I found that by default I don't have the permission to do so. That leads me to suspect that this is not the right way of going about it. What is the correct method?

    I have configured netbeans to use tomcat and I'm not getting any compilation errors.

    Also, are the examples that came with Tomcat different from the sample programs in Netbeans. If yes, how do I run the sample servlets provided in netbeans? Right clicking and selecting "run file" gives
    FAIL - Application already exists at path /


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How to run an example servlet? Using- Netbeans7 & Tomcat6, OS=Ubuntu 10.10, linux

    How are you trying to access by a URL? For tomcat this is typically through port 8080, with the path defined by the deployed jar
    http://localhost:8080/pathtowar/servlet.jsp (depending upon the web.xml mappings in the war)
    I don't use netbeans, so cannot comment on that aspect of your question.

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    26
    My Mood
    Fine
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: How to run an example servlet? Using- Netbeans7 & Tomcat6, OS=Ubuntu 10.10, linux

    Thanks copeg! I don't understand what is meant by "path defined by the deployed jar". How is it determined?

    Forget about Netbeans. (Instead of trying to run individual java files, running the sample project works.)

    What if I write a servlet code, compile it to a class file anywhere on my disk? How do I invoke it in a HTML file so that tomcat can find it?

Similar Threads

  1. How to install the JDK on Ubuntu Linux
    By Brt93yoda in forum Java JDK & IDE Tutorials
    Replies: 2
    Last Post: July 9th, 2011, 07:18 AM
  2. Replies: 1
    Last Post: June 7th, 2011, 11:53 AM
  3. How to install the JDK on Ubuntu Linux
    By Brt93yoda in forum Java Code Snippets and Tutorials
    Replies: 1
    Last Post: June 5th, 2011, 09:09 AM
  4. collecting information/moving from servlet to servlet
    By CBird in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 1st, 2011, 07:04 PM
  5. Help running SQL queries in Ubuntu
    By Mic[RSA] in forum Java IDEs
    Replies: 0
    Last Post: June 29th, 2010, 12:53 PM

Tags for this Thread