Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
public class HelloTag extends TagSupport{
private String name = "World";
public void setName(String name){
this.name = name;
}
public int doEndTag(){
try{
pageContent.getOut().println("Hello " + name);
}
catch(IOException e){}//Ignore it
return EVAL_PAGE;
}
}
and I hav 5 errors to include below;
I can complile other java programs but this will not work.
HelloTag.java:3: package javax.servlet.jsp does not exist
import javax.servlet.jsp.*;
^
HelloTag.java:4: package javax.servlet.jsp.tagext does not exist
import javax.servlet.jsp.tagext.*;
It looks like the jar files containing your classes for import aren't on your classpath. Once you add them to your classpath that particular error should go away.
I can only guess what files you'll need to add, but it looks like jsp-api.jar from the tomcat distribution. You can run javac with something like this - I'm not at my box at the moment, so this may need tweaking:
That runs the java compiler with a classpath made up of the current directory and the path (which you'll need to change for your system) to the jsp-api.jar. Have a look for jsp-api.jar in your tomcat installation directory under common/lib.
First thanks all for your help,
I typed echo $CLASSPATH and it did not do anything but print blank, and I tried the javac -classpath .: path/to/jar-api.jar .java but that still did not work.
I am able to compile my other java file but can if it contains javax.
Thanks alot folks. Its done, classpath set and javac works so far.
But I have another problem, running graphics on my linux box.
From a remote PC if I try to run a graphics program I get this error
Exception in thread "main" java.lang.InternalError:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at java.awt.Window.init(Window.java:231)
at java.awt.Window.<init>(Window.java:275)
at java.awt.Frame.<init>(Frame.java:401)
at javax.swing.JFrame.<init>(JFrame.java:198)
at FrameDemo.<init>(FrameDemo.java:6)
at ShowFrames.main(ShowFrames.java:5)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.