cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling error

Former Member
0 Kudos

Hi all,

I need to compile using command line the HelloWorldSimpleTag.java:

<i>package jsp2.examples.simpletag;

import javax.servlet.jsp.JspException;

import javax.servlet.jsp.tagext.SimpleTagSupport;

import java.io.IOException;

public class HelloWorldSimpleTag extends SimpleTagSupport {

public void doTag() throws JspException, IOException {

getJspContext().getOut().write( "Hello, world!" );

}

}</i>

I use the follow command in order to compile:

<i>javac "D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\jsp-examples\WEB-INF\classes\jsp2\examples\<b>simpletag</b>\HelloWorldSimpleTag.java"</i>

In the <b>simpletag</b> folder I inserted the javax.servlet.jsp.jar library.

But I have compiling error on: <b>package javax.servlet.jsp.jar does not exist!!!!</b>

What I wrong??? Thanks.

Vito

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Vito

<i><b>Are you sure of the Class name ???</b></i>

****************************************************

package jsp2.examples.simpletag;

import javax.servlet.jsp.JspException;

import javax.servlet.jsp.tagext.<b>SimpleTagSupport</b>;

import java.io.IOException;

public class HelloWorldSimpleTag extends <b>SimpleTagSupport</b> {

public void doTag() throws JspException, IOException {

getJspContext().getOut().write( "Hello, world!" );

}

}

*******************************************

See the follwoing API : <b><a href="http://java.sun.com/products/servlet/2.2/javadoc/">API</a></b>

Thanks

Jack

<b>

Allot points if my post helps !!!</b>

Former Member
0 Kudos

Jack,

is the same: <b>package javax.servlet.jsp does not exist!!!</b>

Strange!!! Thanks,

Vito

Former Member
0 Kudos

The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings

Hope this helps,

Bobby

Former Member
0 Kudos

Before you compile the java class, put the servlet jar in your classpath. Since you are compiling in commandline you need to set the classpath like this

set classpath="<directory where ur servlet jar resides>;<other jar files>;;;;;;"

regards,

Sujesh

Answers (3)

Answers (3)

0 Kudos

Are you sure it isn't supposed to be:

import javax.servlet.JspException;

import javax.servlet.tagext.SimpleTagSupport;

(I don't have access to the libs at the moment to double check the names.)

Former Member
0 Kudos

If you are using <b>NWDS / Eclipse</b>:

Right click on project > Java Build path > Libraries tab > Add External Jars and choose the path where your javax.servlet.jsp.jar lies.

<b>Else</b>, in Windows Environment variable, Classpath variable value enter the path to javax.servlet.jsp.jar. For example: the Classpath would look like this:

<b>C:\Jar\javax.servlet.jsp.jar;.;</b>

Former Member
0 Kudos

Hi,

Try,

1. adding servlet-api.jar in the build path (It should be available under commons/lib directory).

2. adding jsp-api.jar in the build path

3. set system variables accordingly.

Regards,

Srinivasan T

<b>Helpful answers=>points</b>