Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:13:57+00:00 2026-05-27T04:13:57+00:00

I created simple Java Servlet: WelcomeServlet.java. Than, I tried compile this file via: javac

  • 0

I created simple Java Servlet: WelcomeServlet.java.

Than, I tried compile this file via:

javac WelcomeServlet.java

In result I see compile error:

package javax.servlet doesn’t exit

I try find solution for this error with Google. And I find first part of answer: java compiler doesnt see servlet-api.jar file.

I know, that Apache Tomcat in it lib folder contains servlet-api.jar file.

So, I have this file, but where I must copy this file??

I try different folders:

echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_26

%PATH% contains this line: C:\Program Files\Java\jdk1.6.0_26\bin

So, I copy in:
%JAVA_HOME%\bin
%JAVA_HOME%\lib
%JAVA_HOME%\jre\lib

And in result same error.
And only after I copy servlet-api.jar in directory:
%JAVA_HOME%\jre\lib\ext

compilation complite sucessful.

My question: Why? Why I must copy in folder %JAVA_HOME%\jre\lib\ext ??

Where This moment describe in documentation?

And other question we have some official docs or specifications that describe folder structure for jdk folder??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:13:58+00:00Added an answer on May 27, 2026 at 4:13 am

    You’ll need to specify the directory or directories you want the compiler to search by using the -classpath command line option when running javac. The reason the compiler found your .jar in %JAVA_HOME%\jre\lib\ext is because it searches the extension directories by default.

    This is for Java 1.5, but I believe it is more or less still correct:

    http://docs.oracle.com/javase/1.5.0/docs/tooldocs/findingclasses.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created java ee application with this tutorial: http://prideafrica.blogspot.com/2007/04/simple-authentication-servlet-filter.html but I do not know
I have created simple Java class to test file writes from applets: update appeared
I'm following Head First Java. I created a simple servlet as they instructed but
I have created some simple app in Java, and 'deployed' it using Java Web
I have created a simple web-service using Java. i want to load jars related
Could someone help me on this, I have created simple web services using axis2
How to manually create Friendly URLs? (PHP) So I have created simple php file
I've created simple program to test Threads in Java. I'd like it to print
I have created simple Java Dynamic Web project in Eclipse. I host my project
I'm using Java Logging API in a simple Servlet application that uses Maven and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.