0

I have trouble with export my very simple project in eclipse SDK: eclipse does't compiling *.jar file for my "core" class.

Struct of my simple project:

│   .classpath
│   .project
│
├───.settings
│       .jsdtscope
│       org.eclipse.jdt.core.prefs
│       org.eclipse.jst.jsp.core.prefs
│       org.eclipse.wst.common.component
│       org.eclipse.wst.common.project.facet.core.xml
│       org.eclipse.wst.css.core.prefs
│       org.eclipse.wst.html.core.prefs
│       org.eclipse.wst.jsdt.ui.superType.container
│       org.eclipse.wst.jsdt.ui.superType.name
│       org.eclipse.wst.ws.service.policy.prefs
│       org.eclipse.wst.xsl.core.prefs
│
├───build
├───src
│   └───my_package
│           core.java
│
└───WebContent
    │   index.jsp
    │
    ├───META-INF
    │       MANIFEST.MF
    │
    └───WEB-INF
        │   web.xml
        │
        ├───classes
        │   └───my_package
        │           core.class
        │
        └───lib

If i running project from eclipse, it's already working, but if I upload WebContent to hosting, I've error.

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>MyProject</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>
Dmitro
  • 1,870
  • 3
  • 16
  • 25

2 Answers2

1

There is nothing wrong with your setup but may be with your export or naming.

With the following steps you will get a working simple webapp with jsp support.

  1. Create new dynamic web project in eclipse
  2. Add an index.jsp page to the WebContent folder
  3. Write something like "Hello World!" to the body of the index.jsp page
  4. export the project as war file and name the war to test.war
  5. Copy this war file to your tomcat/webapps folder and start tomcat
  6. By accessing http://localhost:8080/test you should get the output "Hello World!"
guido
  • 687
  • 4
  • 13
  • in localhost allready works, but eclipse does't build core.jar file for my package "my_package" in WEB-INF/lib/ dir. if i export to *.war and deploying them, core.jar so does't exists – Dmitro Nov 13 '10 at 10:55
  • eclipse doesnt pack your classes in a jar automatically, they all go to WEB-INF/classes. Jars are normally for external libraries. – guido Nov 20 '10 at 20:49
0

Which version do you use from eclipse? Since it is not enough to put a jar into classpath to have them exported into webinf/library. In 3.5 you must add the jar in "java ee module dependencies" section in project properties, in 3.6 it is called "Web Deployment Assembly". Check if your core.jar is in this place.

Gábor Lipták
  • 9,646
  • 2
  • 59
  • 113