Skip to main content
gamedev.net
🔒 Locked

[java] Class path problem when compiling servlet

Started by stodge May 21, 2003 at 2:44 PM 1 replies 1k views
Original Post
stodge
stodge
I''m pretty new to Java and I''m having some stupid problems with classpaths (as many people probably do!). I''m trying to compile a simple test servlet to get familiar with Freemarker, a templating library. My command line to compile the Java servlet is: javac -classpath /opt/tomcat/lib:/opt/j2sdkee1.3.1/lib/j2ee.jar TestServlet.java I copied freemarker.jar into /opt/tomcat/lib/freemarker/, but when I compile I get: TestServlet.java:7: package freemarker.template does not exist import freemarker.template.*; ^ 1 error I also tried, the following: javac -classpath /opt/tomcat/lib/freemarker/freemarker.jar:/opt/j2sdkee1.3.1/lib/j2ee.jar TestServlet.java But no luck here either. Any help or suggestions are greatly appreciated. Thanks http://www.stodge.net - the powerhouse in personal commentary
---------------------http://www.stodge.net
cwraith
cwraith
You''re closer than most people when they first try to figure out the classpath. Your problem is that you''re including a directory which contains jar files. If the directory contains classes (including classes in subdirectories where they have appropriate package names), put the directory in the classpath. If the classes are in a jar file, put the jar file in the classpath.
Petr Stedry
Petr Stedry
Hi,

also the valid separator for classpath arguments is ";" and not ":" IMO (even on linux where it is different from environment variable definition).
Petr Stedry

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.