FWIW, If you're looking to do anything moderately serious, you're going to want to
use Maven to manage your build and dependencies...
$ mvn archetype:generate -DgroupId=com.foo.app -DartifactId=helloworld
-DarchetypeArtifactId=maven-archetype-webapp
$ cd helloworld
add
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>7.0.12</version>
</dependency>
to the <dependencies> element
$ mkdir src/main/java
Add source files into src/main/java, jsp's / static resources into src/main/webapp,
Your web.xml is in src/main/webapp/WEB-INF
To build a .war file:
$ mvn package
The war file will be sitting in target/helloworld.war
PK
-----Original message-----
From: Timothy Murphy <gayleard(a)eircom.net>
Sent: Tue 11-03-2014 10:21
Subject: RE: Java under Fedora
To: users(a)lists.fedoraproject.org;
Patrick Kobly wrote:
> Add the servlet API JAR to the classpath (with -cp or CLASSPATH env
> variable). Or use Maven to build your projects and define the
> dependencies appropriately.
>> When I run "javac HelloWorld.java" I get a number of errors like
>> HelloWorld.java:12: error: cannot find symbol
>> public class HelloWorld extends HttpServlet {
>>
>> I see that this class is in /usr/share/java/tomcat-servlet-api.jar
>> and if I expand this jar file in the current directory
>> then the compilation succeeds.
>> But it is not sufficient to copy the jar file to the current directory
>> (or to put a link to it in /usr/lib/java/ .)>
> Add the servlet API JAR to the classpath (with -cp or CLASSPATH env
> variable). Or use Maven to build your projects and define the
> dependencies appropriately.
Thanks very much,
export CLASSPATH=$CLASSPATH:/usr/share/java/tomcat-servlet-api.jar
did the trick.
I was assuming (rather stupidly) that it was sufficient
to put the directory into the classpath.
.
--
Timothy Murphy
e-mail: gayleard /at/
eircom.net
School of Mathematics, Trinity College, Dublin 2, Ireland
--
users mailing list
users(a)lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct:
http://fedoraproject.org/code-of-conduct
Guidelines:
http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away:
http://ask.fedoraproject.org