Eclipse - add .jar to Dynamic Web Project

后端 未结 5 510
忘掉有多难
忘掉有多难 2020-12-08 14:55

When I use the follow code in eclipse Dynamic Web Project inside servlet , like this :

@WebServlet(\"/CreateCustomerServlet\")
publ         


        
相关标签:
5条回答
  • 2020-12-08 15:17

    Just now I troubleshoot this issue.

    • Just go to properties of your project.
    • Select Deployment Assembly -> add -> Java Build Path Entries.

    And you are done !

    0 讨论(0)
  • 2020-12-08 15:17

    Compile time & runtime are two different things. What ever you added right now is just for compile time & build purpose only. Runtime server tries to load the class. Add same jar to project lib folder also (Which will be packaged with WAR and available for the server at runtime).

    0 讨论(0)
  • 2020-12-08 15:19

    As your screenshot shows, the mysql jar doesn't appear under the Web App Libraries node. Paste the jar in WebContent/WEB-INF/lib, and it will be automatically added to the build path and to the runtime classpath of the webapp (and it will appear under Web App Libraries).

    0 讨论(0)
  • 2020-12-08 15:39

    Try doing this:

    Make a directory named lib in the root directory of the proyect and put the .jar in it.

    In the WEB-INF directory, make a link to lib.

    Now, the jar would appear under WebbApp Libraries.

    0 讨论(0)
  • 2020-12-08 15:40

    The solution is quite straightforward:

     1. Right click on the your web project and choose PROPERTIES
    
     2. Choose the J2EE Module Dependencies
    
     3. Click on the Add External JARs… and then point on your library file (ZIP or JAR)
    
     4. Click on Apply then OK.
    
     5. Restart your Apache Tomcat
    

    The added library should be seen under: ProjectName > Java Resources: src > Libraries > WebApp Libraries.

    0 讨论(0)
提交回复
热议问题