Trouble compiling a servlet
This may be a dumb question, but is there any way to compile a servlet without using ant?
nevermind, I got it...
Similar Messages
-
Trouble compiling a Servlet using the JSWDK-1.0.1
I have an old Win95 box on which I had a JDK 1.2 install and I then installed the JSWDK-1.0.1. I have the servlet.jar and jspengine.jar files in the "\lib" directory and have added them to my classpath.
I created a simple servlet but it does not read any classes from the JSWDK .jar files and throws an error saying class HTTPServlet not found. The first few lines of my servlet look like:
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HTTPServlet
Any idea why the "javac" compiler cant see the class from the proper jar file? I am using JBuilder as my source code editor and it too shows all the servlet related class/package names in red (i.e. doesnt recognize them).
Regular java apps compile and run fine on this machine.Hi,
It should be definitely a CLASSPATH problem. You can double check the CLASSPATH in command prompt like this
echo %CLASSPATH%
If the CLASSPATH is set properly, you should see something like this
c:\jdk1.2\lib\tools.jar;c:\jswdk-1.0.1\lib\servlet.jar
Hope this helps.
Best Luck!
Senthil Babu J -
Compiling a servlet with utility class
Hello,
I am having trouble compiling a servlet that uses a utility class.
The compiler doesn't seem to recognize the utility class for some reason.
my classpath is set to:
.;C:\ServletDevel;C:\Program Files\Apache Software Foundation\common\lib\servlet-api.jar
the error:
Cannot find symbol: ServletUtilities
the servlet code:
package coreservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/** test the use of packages and utilities on the server */
public class helloservlet3 extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Hello (3)";
out.println(ServletUtilities.headWithTitle(title) +
"<body bgcolor=\"#FDF5E6\">\n" +
"<h1>" + title + "</h1>\n" +
"</body></html>");
the utility class:
package coreservlets;
import javax.servlet.*;
import javax.servlet.http.*;
/** time saving static methods */
public class ServletUtilities {
public final static String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">";
public static String headWithTitle(String title){
return (docType + "\n" + "<html>\n" +
"<head><title>" + title + "</title></head>\n");
any help wouldbe greatly appreciated.Nope still getting an error
helloservlet3.java:17:cannot find symbol
symbol : class ServletUtilities
location: package coreservlets
out.println(coreservlets.ServletUtilities.headWithTitle(title) +
thanks for the help, i'll keep on trying to figure it out. -
Trouble compiling servlet example
Hi All, I am trying out an example for servlets and I ran into trouble compiling the the file called "FormProcessingServlet.java" in tutorial located here: http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/magercises/FormPostingAndProcessing/index.html
The exact problem happens in this line:
isStructure = context.getResourceAsStream(paramStructureFile[0]);
The error says:
FormProcessingServlet.java:127: cannot resolve symbol
symbol : method getResourceAsStream (java.lang.String)
location: interface javax.servlet.ServletContext
isStructure = context.getResourceAsStream(paramStructureFile[0]);
anyone else ran into this problem? How do I fix this? Thanks."cannot resolve symbol" means that the JVM can't find a particular class.
Adjust your systems classpath variable to include all the jar files that you use, I also add "." to include files in the current directory I'm working from. -
Trouble compiling servlets with J2SE 5
Hello,
I've been using Sun 1 Studio CE, and more recently, Netbeans 3.6, with J2SE 1.4.2. I have some basic swing applets and servlets that I wrote for my business' web site.
I recently downloaded and installed the new software bundle containing Netbeans 4.0 and J2SE 1.5. When I try to compile my servlets, I get a compiler error that packages javax.servlet.* and javax.servlet.http.* do not exist.
I reinstalled J2SE 1.4.2 and Netbeans 3.6 and the servlets compile fine.
Why is JDK 5 not able to find these packages? My understanding is that they're part of the Java Servlet API, which I never explicitly downloaded previously. Is that the piece of the puzzle that I'm missing? Please help!
ThanksThanks for your response...
What is interesting is that I never explicitly installed the Servlet API. Out of curiosity, I searched my computer for servlet*.jar and came up with 13 files including:
servlet-2.2.jar
servlet-2.3.jar
servlet-api-2.4.jar
These were located in subdirectories under Netbeans 3.6 and Tomcat 5.0.19. Therefore, I'm assuming that when I downloaded the JDK 1.4.2/Netbeans 3.6 bundle from the Java site, the Servlet API must have been part of the bundle.
****Let me check something...***
I've just done the same search for servlet*.jar on my test PC, which has the Netbeans 4.0/JDK 5 bundle installed. The same files exist, in the same locations(almost the same, anyway; the Tomcat and Netbeans 4 directory structures are a little different).
Both software bundles contain the same files, yet 1.4.2 compiles without any problems or additional configuration. In other words, I reinstalled the old 1.4.2/ Netbeans 3.6 bundle, took my existing source code, and started compiling.
Any ideas why the same isn't true for JDK 5/Netbeans 4? I know there are changes to the way Netbeans 4.0 deals with Class Paths, but I thought that was for the classes I've written. Shouldn't the compiler be able to find the servlet API, since it bundled/installed with everything else?
Thanks -
How to Compile/Run servlet in Tomcat 4.1
Hi All,
iam trying to compile my servlet program in tomcat4.1.. but its showing an error
in the import statement..
UN SOLVABLE SYMBOL... but the import ststement is correct...
can any one help ... is there i have to set any path for compiling/running the servlet...
Thanks in Advicehi thanks for your reply
i have loaded tomcat4.1 exe -- for windows i am starting the tomcat server by clicking from the start menu..
i dint set any env variable .. tell me how to set...
regards
ijay -
Trouble Compiling my Email-client
Hi
I have written this email -client, but have some trouble compiling it !
Then I try to compile it the following errors:
MailClient.java:350: <identifier> expected
public syncronize void mails(String t){
^
MailClient.java:727: ';' expected
private class myWindowListener extends WindowAdapter{
^
MailClient.java:747: '}' expected
3 errors.
What do I need to change to correct these errors ?
I hope that there is somebody out there who can help me get my program to work.
Thanks in advance.
Sincrely Yours
Fred
import java.io.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class MailClient extends JFrame implements ActionListener{
private Sendman mySendman;
private Letterman myLetterman;
public Writer myWrite;
public Reader myReader;
public Composer myComposer;
private Setup mySetup;
public Addressbook myAdressbook;
private FixTask myFixTask;
private Filter myFilter;
private Info myInfo;
public Vector mailIndexVector = new Vector();
public Vector filterIndexVector = new Vector();
public Vector folderVector = new Vector();
private JPanel tArea, trae, icon, tField;
private JTextArea ta;
private JScrollPane view, treeScroll;
private JTree tree;
public JTextField tf;
private JSplitPane split;
private Dimension Size;
private MailClient myMailClient;
private String mailBody, subject, from;
public boolean fromOutbox = false;
public boolean viewSource = false;
public static void main (String[] args) {
MailClient myMailClient = new MailClient();
public MailClient() {
super("Mail-Client");
ImageIcon linux = new ImageIcon("linux.gif");
this.setIconImage(linux.getImage());
icon = new JPanel();
icon.setLayout(new FlowLayout(FlowLayout.LEFT));
ImageIcon neu = new ImageIcon("getmail.gif");
JButton neueMails = new JButton(neu);
newMails.setActionCommand("Getting new Mails");
newMails.addActionListener(this);
newMails.setBorderPainted(false);
newMails.setToolTipText("Getting new Mails");
ImageIcon cr = new ImageIcon("creator.gif");
JButton creator = new JButton(cr);
creator.setActionCommand("Creator open");
creator.addActionListener(this);
creator.setBorderPainted(false);
creator.setToolTipText("Creator open");
JButton rep = new JButton(new ImageIcon("reply.gif"));
rep.setActionCommand("rep");
rep.addActionListener(this);
rep.setBorderPainted(false);
rep.setToolTipText("Reply");
JButton fwd = new JButton(new ImageIcon("fwd.gif"));
fwd.setActionCommand("fwd");
fwd.addActionListener(this);
fwd.setBorderPainted(false);
fwd.setToolTipText("Forward");
JButton ein = new JButton(new ImageIcon("settings.gif"));
ein.setActionCommand("settings open");
ein.addActionListener(this);
ein.setBorderPainted(false);
ein.setToolTipText("Setting open");
JButton adr = new JButton(new ImageIcon("adressbook.gif"));
adr.setActionCommand("adr");
adr.addActionListener(this);
adr.setBorderPainted(false);
adr.setToolTipText("Addressbook");
JButton lo = new JButton(new ImageIcon("trash.gif"));
lo.setActionCommand("trash");
lo.addActionListener(this);
lo.setBorderPainted(false);
lo.setToolTipText("trash");
JButton in = new JButton(new ImageIcon("info.gif"));
in.setActionCommand("Information");
in.addActionListener(this);
in.setBorderPainted(false);
in.setToolTipText("Information");
icon.add(newMails);
icon.add(creator);
icon.add(rep);
icon.add(fwd);
icon.add(set);
icon.add(adr);
icon.add(lo);
icon.add(in);
Vector h1 = myLeser.lese("Summary.4on");
for(int i=0; i<h1.size(); i+=7){
String id = h1.elementAt(i).toString();
String fo = h1.elementAt(i+1).toString();
String su = h1.elementAt(i+2).toString();
String fr = h1.elementAt(i+3).toString();
String to = h1.elementAt(i+4).toString();
String da = h1.elementAt(i+5).toString();
String re = h1.elementAt(i+6).toString();
MailIndex index = new MailIndex(id, fo, su, fr, to, da, re);
mailIndexVector.addElement(index);
Vector h2 = myReader.read("Filter.4on");
for(int j=0; j<h2.size(); j+=3){
String fo = h2.elementAt(j).toString();
String from = h2.elementAt(j+1).toString();
String te = h2.elementAt(j+2).toString();
FilterIndex index = new FilterIndex(fo, from, te);
filterIndexVector.addElement(index);
folderVector = myReader.read("Folder.4on");
DefaultMutableTreeNode top, inbox, outbox, sentbox, trash;
top = new DefaultMutableTreeNode("mails");
top.add(inbox = new DefaultMutableTreeNode("Inbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Inbox"))
inbox.add(new DefaultMutableTreeNode(m));
top.add(outbox = new DefaultMutableTreeNode("Outbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Outbox")){
outbox.add(new DefaultMutableTreeNode(m));
top.add(sentbox = new DefaultMutableTreeNode("Sentbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Sentbox"))
sentbox.add(new DefaultMutableTreeNode(m));
for(int j=0; j<folderVector.size(); j++){
top.add(trash =
new DefaultMutableTreeNode(folderVector.elementAt(j).toString()));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals(folderVector.elementAt(j).toString()))
trash.add(new DefaultMutableTreeNode(m));
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new myTreeSelectionListener());
treeScroll = new JScrollPane(tree);
treeScroll.setFont(new Font("Monospaced",Font.PLAIN,6));
baum.add("Center", treeScroll);
MainMenu menuBar = new MainMenu(this, this);
setJMenuBar(menuBar);
setVisible(true);
public void mailsFetcher() {
myLetterman = new Letterman(this, mySetup);
myLetterman.start();
public void treeNewSign(){
trae.remove(treeScroll);
DefaultMutableTreeNode top, inbox, outbox, sentbox, trash;
top = new DefaultMutableTreeNode("mails");
top.add(inbox = new DefaultMutableTreeNode("Inbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Inbox"))
inbox.add(new DefaultMutableTreeNode(m));
top.add(outbox = new DefaultMutableTreeNode("Outbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Outbox"))
outbox.add(new DefaultMutableTreeNode(m));
top.add(sentbox = new DefaultMutableTreeNode("Sentbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Sentbox"))
sentbox.add(new DefaultMutableTreeNode(m));
for(int j=0; j<folderVector.size(); j++){
top.add(trash =
new DefaultMutableTreeNode(folderVector.elementAt(j).toString()));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals(folderVector.elementAt(j).toString()))
trash.add(new DefaultMutableTreeNode(m));
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new myTreeSelectionListener());
treeScroll = new JScrollPane(tree);
trae.add("Center", treeScroll);
trae.repaint();
setVisible(true);
public void menuNewSign(){
setJMenuBar(new MainMenu(this, this));
setVisible(true);
public String fromFilter (String t){
String myFrom = "";
int start, end;
int a = t.indexOf("From:");
if (a != -1){
start = a + 6;
ende = t.indexOf("\n",start);
myFrom = t.substring(start,end);
return myFrom;
public String toFilter (String t){
String myTo = "";
int start, e1, e2, end;
int a = t.indexOf("To:");
if (a != -1){
start = a + 4;
end = t.indexOf("\n",start);
myTo = t.substring(start,end);
e1 = end + 1;
if(t.substring(e1,e1+1).equals(" ")){
while(t.substring(e1,e1+1).equals(" ")){
while(t.substring(e1,e1+1).equals(" "))
e1++;
e2 = t.indexOf("\n",e1);
myTo += " " + t.substring(e1,e2);
e1 = e2 + 1;
return myTo;
public String dateFilter (String t){
String myDate = "";
int start, end;
int a = t.indexOf("Date:");
if (a != -1){
start = a + 6;
end = t.indexOf("\n",start);
myDate = t.substring(start,end);
return myDate;
public String subjectFilter (String t){
String mySubject = "";
int start, end;
int a = t.indexOf("Subject:");
if (a != -1){
start = a + 9;
end = t.indexOf("\n",start);
mySubject = t.substring(start,end);
return mySubject;
public String mailFilter (String t){
String myMail = "";
int start = 0, end = t.length();
start = t.indexOf("\n\n") + 2;
if (start != 1){
int a = t.indexOf("\n\n" ,start);
if (a != -1){
if (t.indexOf(".",a+2) == a+2)
if (t.indexOf("\n",a+3) == a+3)
start = a;
myMail = t.substring(start,end);
return myMail;
public void mailsRemark(String file){
String mail = "", t = "";
Vector mailVector = myReader.read(file);
for (int i=0; i<mailVector.size(); i++)
t += (String)mailVector.elementAt(i) + "\n";
from = fromFilter(t);
subject = subjectFilter(t);
mailBody = mailFilter(t);
mail += "Subject: " + subject + "\n";
mail += "Date: " + dateFilter(t) + "\n";
mail += "From: " + from + "\n";
mail += "To: " + toFilter(t) + "\n";
mail += "\n" + mailBody;
if(viewSource == true)
ta.setText(t);
else
ta.setText(mail);
public syncronize void mails(String t){
Status myStatus = new Status(this,t);
myStatus.start();
public void delete(){
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
if(node.isLeaf()){
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailIndexVector.removeElement(index);
int count = 0;
for(int j=0; j<mailIndexVector.size(); j++){
MailIndex index1 = (MailIndex)mailIndexVector.elementAt(j);
String id = index1.mailId;
if(id.equals(index.mailId))
count++;
if(count == 0){
File home = new File(".");
String mailsRemark = "." + home.separator + "data";
File datei = new File(mailsRemark, index.mailId);
datei.delete();
treeNewSign();
menuNewSign();
else{
String t = (String)nodeInfo;
boolean toDelete = false;
for (int i=0; i<folderVector.size(); i++){
if(folderVector.elementAt(i).equals(t)){
folderVector.removeElement(t);
konnteLoeschen = true;
if(toDelete == false){
message("This folder can not be deleted!");
treeNewSign();
else
message("Folder is not Empty! Please delete Your mails.");
else
message("No Mails where selected to be deleted!");
public void forward(){
if(from != null){
creatorOeffnen();
myCreator.tfSb.setText("Fwd to: " + subject);
myCreator.ta.setText("<" + from + ">" + " wrote:\n\n" + mailBody +
"\n\n>\n>\n\n");
public void reply(){
if(from != null){
creatorOeffnen();
myCreator.tfTo.setText(from);
myCreator.tfSb.setText("Reply to: " + subject);
myCreator.ta.setText("<" + from + ">" + " wrote:\n\n" + mailBody +
"\n\n>\n>\n\n");
public void end(){
String h = "";
for (int i=0; i<mailIndexVector.size(); i++){
MailIndex index = (MailIndex)mailIndexVector.elementAt(i);
h += index.mailId + "\n";
h += index.folder + "\n";
h += index.subject + "\n";
h += index.from + "\n";
h += index.to + "\n";
h += index.date + "\n";
h += index.read + "\n";
myWriter.writer(h,"Summary.4on");
String w = "";
for (int l=0; l<filterIndexVector.size(); l++){
FilterIndex index = (FilterIndex)filterIndexVector.elementAt(l);
w += index.folder + "\n";
w += index.from + "\n";
w += index.text + "\n";
myWriter.write(w,"Filter.4on");
String k = "";
for(int j=0; j<folderVector.size(); j++)
k += folderVector.elementAt(j).toString() + "\n";
myWriter.writer(k,"Folder.4on");
String t = "";
for (int l=0; l<myAddressBook.addressIndexVector.size(); l++){
AddressIndex aindex =
(AddressIndex)myAdressBook.adressIndexVector.elementAt(l);
t += aindex.alias + "\n";
t += aindex.email + "\n";
myWriter.write(t,"Address.4on");
setVisible(false);
dispose();
System.exit(0);
public void filterOpen(){
boolean test = false;
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof String){
myFilter.folder = (String)nodeInfo;
for(int i=0; i<filterIndexVector.size(); i++){
FilterIndex h = (FilterIndex)filterIndexVector.elementAt(i);
if(h.folder.equals(nodeInfo)){
myFilter.index = h;
test = true;
if(h.from.equals("")){
myFilter.box1 = false;
myFilter.fTf.setText("");
myFilter.fBox.setSelected(false);
myFilter.fTf.setEditable(false);
else{
myFilter.box1 = true;
myFilter.fTf.setText(h.from);
myFilter.fBox.setSelected(true);
myFilter.fTf.setEditable(true);
if(h.text.equals("")){
myFilter.box2 = false;
myFilter.tTf.setText("");
myFilter.tBox.setSelected(false);
myFilter.tTf.setEditable(false);
else{
myFilter.box2 = true;
myFilter.tTf.setText(h.text);
myFilter.tBox.setSelected(true);
myFilter.tTf.setEditable(true);
break;
myFilter.setVisible(true);
myFilter.fBox.requestFocus();
else
meldung("No selection");
public void sendOutbox(){
fromOutbox = true;
int i;
Block1:
for(i=0; i<mailIndexVector.size(); i++){
MailIndex index = (MailIndex)mailIndexVector.elementAt(i);
if(index.folder.equals("Outbox")){
Vector mailVector = myReader.read(index.mailId);
Block2:
for(int j=0; j<mailVector.size(); j++){
String m = (String)mailVector.elementAt(j);
if(m.indexOf("Subject:") != -1){
for(int k=0; k<=j+1; k++){
mailVector.removeElementAt(0);
break Block2;
Vector toVector = new Vector();
int tEnd = 1;
String line = "";
String t = index.to;
while (tEnd != -1){
tEnd = t.indexOf(", ");
if (tEnd == -1)
line = t;
else
line = t.substring(0,tEnd);
t = t.substring(tEnd + 1);
toVector.addElement(line);
File home = new File(".");
String mailsVerzeichnis = "." + home.separator + "data";
File datei = new File(mailsRemark, index.mailId);
datei.delete();
mySendman = new Sendman(mailVector, toVector, index.subject,
ailsAnzeig mySetup, this);
mySendman.start();
mailIndexVector.removeElement(index);
break Block1;
if(i == mailIndexVector.size())
fromOutbox = false;
treeNewSign();
public void partion(String cmd){
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
index.folder = cmd.substring(13).toString();
treeNewSign();
else
meldung("No mails to partion!");
public void SetupOpen(){
if (mySetup.savePassword == false)
mySetup.pTf.setText("");
mySetup.setVisible(true);
mySetup.aTf.requestFocus();
public void addressbookOpen(){
myAddressBook.setVisible(true);
myAdressBook.tree.requestFocus();
public void creatorOpen(){
myCreator.setVisible(true);
myCreator.tfTo.requestFocus();
public void actionPerformed(ActionEvent event){
Object obj = event.getSource();
if (obj instanceof JMenuItem){
String cmd = event.getActionCommand();
if (cmd.equals("New fetched")){
mailsfetch();
else if (cmd.equals("Written new mails")) {
creatorOpen();
else if (cmd.equals("Reply")) {
reply();
else if (cmd.equals("Forward")) {
forward();
else if (cmd.equals("Outbox")) {
sendOutbox();
else if (cmd.equals("Delete")) {
delete();
else if ((cmd.length() >13) &&
(cmd.substring(0,13).equals("Sorting-"))){
sorting(cmd);
else if (cmd.equals("Using Addressbook")){
addressbookOpen();
else if (cmd.equals("Filter working")){
filterOpen();
else if (cmd.equals("New Order")){
myFixTask.tf.setText("");
myFixTask.setVisible(true);
myFixTask.tf.requestFocus();
else if (cmd.equals("delete")){
delete();
else if ((cmd.length() >7) &&
(cmd.substring(0,7).equals("nobody"))){
if(viewSource == false){
viewSource = true;
menuNewSign();
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsRemark(index.mailId);
else{
viewSource = false;
menuNeuZeichnen();
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsRemark(index.mailId);
else if (cmd.equals("Setup")){
SetupOpen();
else if (obj instanceof JButton){
String cmd = event.getActionCommand();
if (cmd.equals("aga")){
mailsHolen();
else if (cmd.equals("Creator Open")){
creatorOpem();
else if(cmd.equals("rep")){
reply();
else if(cmd.equals("fwd")){
forward();
else if(cmd.equals("Setup Open")){
SetupOpen();
else if(cmd.equals("adr")){
addressbookOpen();
else if(cmd.equals("delete")){
delete();
else if(cmd.equals("Information")){
myInfo.setVisible(true);
myInfo.b.requestFocus();
private class myWindowListener extends WindowAdapter{
public void windowClosing(WindowEvent event){
end();
private class myTreeSelectionListener implements TreeSelectionListener{
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)(e.getPath().getLastPathComponent());
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsAnzeigen(index.mailId);
index.read = "Yes";Some suggestions:
1. as the others stated- you should really post specific questions rather than 1 huge ugly class!
2. use code tags
3. get a decent IDE- it would take about 1 minute to then see where the error is-
4. the rrors were just misspelled 'synchronized' and missing argument ','
5. Try not to make such huge classes!!- Try to follow certain coding "patterns"- like MVC- and not stick everything in 1 class- separate the functionality- it makes coding much easier!
here is fixed code (at least gets rid of those last errors):
import java.io.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class MailClient extends JFrame implements ActionListener{
private Sendman mySendman;
private Letterman myLetterman;
public Writer myWrite;
public Reader myReader;
public Composer myComposer;
private Setup mySetup;
public Addressbook myAdressbook;
private FixTask myFixTask;
private Filter myFilter;
private Info myInfo;
public Vector mailIndexVector = new Vector();
public Vector filterIndexVector = new Vector();
public Vector folderVector = new Vector();
private JPanel tArea, trae, icon, tField;
private JTextArea ta;
private JScrollPane view, treeScroll;
private JTree tree;
public JTextField tf;
private JSplitPane split;
private Dimension Size;
private MailClient myMailClient;
private String mailBody, subject, from;
public boolean fromOutbox = false;
public boolean viewSource = false;
public static void main (String[] args) {
MailClient myMailClient = new MailClient();
public MailClient() {
super("Mail-Client");
ImageIcon linux = new ImageIcon("linux.gif");
this.setIconImage(linux.getImage());
icon = new JPanel();
icon.setLayout(new FlowLayout(FlowLayout.LEFT));
ImageIcon neu = new ImageIcon("getmail.gif");
JButton neueMails = new JButton(neu);
newMails.setActionCommand("Getting new Mails");
newMails.addActionListener(this);
newMails.setBorderPainted(false);
newMails.setToolTipText("Getting new Mails");
ImageIcon cr = new ImageIcon("creator.gif");
JButton creator = new JButton(cr);
creator.setActionCommand("Creator open");
creator.addActionListener(this);
creator.setBorderPainted(false);
creator.setToolTipText("Creator open");
JButton rep = new JButton(new ImageIcon("reply.gif"));
rep.setActionCommand("rep");
rep.addActionListener(this);
rep.setBorderPainted(false);
rep.setToolTipText("Reply");
JButton fwd = new JButton(new ImageIcon("fwd.gif"));
fwd.setActionCommand("fwd");
fwd.addActionListener(this);
fwd.setBorderPainted(false);
fwd.setToolTipText("Forward");
JButton ein = new JButton(new ImageIcon("settings.gif"));
ein.setActionCommand("settings open");
ein.addActionListener(this);
ein.setBorderPainted(false);
ein.setToolTipText("Setting open");
JButton adr = new JButton(new ImageIcon("adressbook.gif"));
adr.setActionCommand("adr");
adr.addActionListener(this);
adr.setBorderPainted(false);
adr.setToolTipText("Addressbook");
JButton lo = new JButton(new ImageIcon("trash.gif"));
lo.setActionCommand("trash");
lo.addActionListener(this);
lo.setBorderPainted(false);
lo.setToolTipText("trash");
JButton in = new JButton(new ImageIcon("info.gif"));
in.setActionCommand("Information");
in.addActionListener(this);
in.setBorderPainted(false);
in.setToolTipText("Information");
icon.add(newMails);
icon.add(creator);
icon.add(rep);
icon.add(fwd);
icon.add(set);
icon.add(adr);
icon.add(lo);
icon.add(in);
Vector h1 = myLeser.lese("Summary.4on");
for(int i=0; i<h1.size(); i+=7){
String id = h1.elementAt(i).toString();
String fo = h1.elementAt(i+1).toString();
String su = h1.elementAt(i+2).toString();
String fr = h1.elementAt(i+3).toString();
String to = h1.elementAt(i+4).toString();
String da = h1.elementAt(i+5).toString();
String re = h1.elementAt(i+6).toString();
MailIndex index = new MailIndex(id, fo, su, fr, to, da, re);
mailIndexVector.addElement(index);
Vector h2 = myReader.read("Filter.4on");
for(int j=0; j<h2.size(); j+=3){
String fo = h2.elementAt(j).toString();
String from = h2.elementAt(j+1).toString();
String te = h2.elementAt(j+2).toString();
FilterIndex index = new FilterIndex(fo, from, te);
filterIndexVector.addElement(index);
folderVector = myReader.read("Folder.4on");
DefaultMutableTreeNode top, inbox, outbox, sentbox, trash;
top = new DefaultMutableTreeNode("mails");
top.add(inbox = new DefaultMutableTreeNode("Inbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Inbox"))
inbox.add(new DefaultMutableTreeNode(m));
top.add(outbox = new DefaultMutableTreeNode("Outbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Outbox")){
outbox.add(new DefaultMutableTreeNode(m));
top.add(sentbox = new DefaultMutableTreeNode("Sentbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Sentbox"))
sentbox.add(new DefaultMutableTreeNode(m));
for(int j=0; j<folderVector.size(); j++){
top.add(trash =
new DefaultMutableTreeNode(folderVector.elementAt(j).toString()));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals(folderVector.elementAt(j).toString()))
trash.add(new DefaultMutableTreeNode(m));
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new myTreeSelectionListener());
treeScroll = new JScrollPane(tree);
treeScroll.setFont(new Font("Monospaced",Font.PLAIN,6));
baum.add("Center", treeScroll);
MainMenu menuBar = new MainMenu(this, this);
setJMenuBar(menuBar);
setVisible(true);
public void mailsFetcher() {
myLetterman = new Letterman(this, mySetup);
myLetterman.start();
public void treeNewSign(){
trae.remove(treeScroll);
DefaultMutableTreeNode top, inbox, outbox, sentbox, trash;
top = new DefaultMutableTreeNode("mails");
top.add(inbox = new DefaultMutableTreeNode("Inbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Inbox"))
inbox.add(new DefaultMutableTreeNode(m));
top.add(outbox = new DefaultMutableTreeNode("Outbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Outbox"))
outbox.add(new DefaultMutableTreeNode(m));
top.add(sentbox = new DefaultMutableTreeNode("Sentbox"));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals("Sentbox"))
sentbox.add(new DefaultMutableTreeNode(m));
for(int j=0; j<folderVector.size(); j++){
top.add(trash =
new DefaultMutableTreeNode(folderVector.elementAt(j).toString()));
for(int i=0; i<mailIndexVector.size(); i++){
MailIndex m = (MailIndex)mailIndexVector.elementAt(i);
if (m.folder.equals(folderVector.elementAt(j).toString()))
trash.add(new DefaultMutableTreeNode(m));
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new myTreeSelectionListener());
treeScroll = new JScrollPane(tree);
trae.add("Center", treeScroll);
trae.repaint();
setVisible(true);
public void menuNewSign(){
setJMenuBar(new MainMenu(this, this));
setVisible(true);
public String fromFilter (String t){
String myFrom = "";
int start, end;
int a = t.indexOf("From:");
if (a != -1){
start = a + 6;
ende = t.indexOf("\n",start);
myFrom = t.substring(start,end);
return myFrom;
public String toFilter (String t){
String myTo = "";
int start, e1, e2, end;
int a = t.indexOf("To:");
if (a != -1){
start = a + 4;
end = t.indexOf("\n",start);
myTo = t.substring(start,end);
e1 = end + 1;
if(t.substring(e1,e1+1).equals(" ")){
while(t.substring(e1,e1+1).equals(" ")){
while(t.substring(e1,e1+1).equals(" "))
e1++;
e2 = t.indexOf("\n",e1);
myTo += " " + t.substring(e1,e2);
e1 = e2 + 1;
return myTo;
public String dateFilter (String t){
String myDate = "";
int start, end;
int a = t.indexOf("Date:");
if (a != -1){
start = a + 6;
end = t.indexOf("\n",start);
myDate = t.substring(start,end);
return myDate;
public String subjectFilter (String t){
String mySubject = "";
int start, end;
int a = t.indexOf("Subject:");
if (a != -1){
start = a + 9;
end = t.indexOf("\n",start);
mySubject = t.substring(start,end);
return mySubject;
public String mailFilter (String t){
String myMail = "";
int start = 0, end = t.length();
start = t.indexOf("\n\n") + 2;
if (start != 1){
int a = t.indexOf("\n\n" ,start);
if (a != -1){
if (t.indexOf(".",a+2) == a+2)
if (t.indexOf("\n",a+3) == a+3)
start = a;
myMail = t.substring(start,end);
return myMail;
public void mailsRemark(String file){
String mail = "", t = "";
Vector mailVector = myReader.read(file);
for (int i=0; i<mailVector.size(); i++)
t += (String)mailVector.elementAt(i) + "\n";
from = fromFilter(t);
subject = subjectFilter(t);
mailBody = mailFilter(t);
mail += "Subject: " + subject + "\n";
mail += "Date: " + dateFilter(t) + "\n";
mail += "From: " + from + "\n";
mail += "To: " + toFilter(t) + "\n";
mail += "\n" + mailBody;
if(viewSource == true)
ta.setText(t);
else
ta.setText(mail);
public synchronized void mails(String t){
Status myStatus = new Status(this,t);
myStatus.start();
public void delete(){
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
if(node.isLeaf()){
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailIndexVector.removeElement(index);
int count = 0;
for(int j=0; j<mailIndexVector.size(); j++){
MailIndex index1 = (MailIndex)mailIndexVector.elementAt(j);
String id = index1.mailId;
if(id.equals(index.mailId))
count++;
if(count == 0){
File home = new File(".");
String mailsRemark = "." + home.separator + "data";
File datei = new File(mailsRemark, index.mailId);
datei.delete();
treeNewSign();
menuNewSign();
else{
String t = (String)nodeInfo;
boolean toDelete = false;
for (int i=0; i<folderVector.size(); i++){
if(folderVector.elementAt(i).equals(t)){
folderVector.removeElement(t);
konnteLoeschen = true;
if(toDelete == false){
message("This folder can not be deleted!");
treeNewSign();
else
message("Folder is not Empty! Please delete Your mails.");
else
message("No Mails where selected to be deleted!");
public void forward(){
if(from != null){
creatorOeffnen();
myCreator.tfSb.setText("Fwd to: " + subject);
myCreator.ta.setText("<" + from + ">" + " wrote:\n\n" + mailBody +
"\n\n>\n>\n\n");
public void reply(){
if(from != null){
creatorOeffnen();
myCreator.tfTo.setText(from);
myCreator.tfSb.setText("Reply to: " + subject);
myCreator.ta.setText("<" + from + ">" + " wrote:\n\n" + mailBody +
"\n\n>\n>\n\n");
public void end(){
String h = "";
for (int i=0; i<mailIndexVector.size(); i++){
MailIndex index = (MailIndex)mailIndexVector.elementAt(i);
h += index.mailId + "\n";
h += index.folder + "\n";
h += index.subject + "\n";
h += index.from + "\n";
h += index.to + "\n";
h += index.date + "\n";
h += index.read + "\n";
myWriter.writer(h,"Summary.4on");
String w = "";
for (int l=0; l<filterIndexVector.size(); l++){
FilterIndex index = (FilterIndex)filterIndexVector.elementAt(l);
w += index.folder + "\n";
w += index.from + "\n";
w += index.text + "\n";
myWriter.write(w,"Filter.4on");
String k = "";
for(int j=0; j<folderVector.size(); j++)
k += folderVector.elementAt(j).toString() + "\n";
myWriter.writer(k,"Folder.4on");
String t = "";
for (int l=0; l<myAddressBook.addressIndexVector.size(); l++){
AddressIndex aindex =
(AddressIndex)myAdressBook.adressIndexVector.elementAt(l);
t += aindex.alias + "\n";
t += aindex.email + "\n";
myWriter.write(t,"Address.4on");
setVisible(false);
dispose();
System.exit(0);
public void filterOpen(){
boolean test = false;
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof String){
myFilter.folder = (String)nodeInfo;
for(int i=0; i<filterIndexVector.size(); i++){
FilterIndex h = (FilterIndex)filterIndexVector.elementAt(i);
if(h.folder.equals(nodeInfo)){
myFilter.index = h;
test = true;
if(h.from.equals("")){
myFilter.box1 = false;
myFilter.fTf.setText("");
myFilter.fBox.setSelected(false);
myFilter.fTf.setEditable(false);
else{
myFilter.box1 = true;
myFilter.fTf.setText(h.from);
myFilter.fBox.setSelected(true);
myFilter.fTf.setEditable(true);
if(h.text.equals("")){
myFilter.box2 = false;
myFilter.tTf.setText("");
myFilter.tBox.setSelected(false);
myFilter.tTf.setEditable(false);
else{
myFilter.box2 = true;
myFilter.tTf.setText(h.text);
myFilter.tBox.setSelected(true);
myFilter.tTf.setEditable(true);
break;
myFilter.setVisible(true);
myFilter.fBox.requestFocus();
else
meldung("No selection");
public void sendOutbox(){
fromOutbox = true;
int i;
Block1:
for(i=0; i<mailIndexVector.size(); i++){
MailIndex index = (MailIndex)mailIndexVector.elementAt(i);
if(index.folder.equals("Outbox")){
Vector mailVector = myReader.read(index.mailId);
Block2:
for(int j=0; j<mailVector.size(); j++){
String m = (String)mailVector.elementAt(j);
if(m.indexOf("Subject:") != -1){
for(int k=0; k<=j+1; k++){
mailVector.removeElementAt(0);
break Block2;
Vector toVector = new Vector();
int tEnd = 1;
String line = "";
String t = index.to;
while (tEnd != -1){
tEnd = t.indexOf(", ");
if (tEnd == -1)
line = t;
else
line = t.substring(0,tEnd);
t = t.substring(tEnd + 1);
toVector.addElement(line);
File home = new File(".");
String mailsVerzeichnis = "." + home.separator + "data";
File datei = new File(mailsRemark, index.mailId);
datei.delete();
mySendman = new Sendman(mailVector, toVector, index.subject,ailsAnzeig, mySetup, this);
mySendman.start();
mailIndexVector.removeElement(index);
break Block1;
if(i == mailIndexVector.size())
fromOutbox = false;
treeNewSign();
public void partion(String cmd){
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
index.folder = cmd.substring(13).toString();
treeNewSign();
else
meldung("No mails to partion!");
public void SetupOpen(){
if (mySetup.savePassword == false)
mySetup.pTf.setText("");
mySetup.setVisible(true);
mySetup.aTf.requestFocus();
public void addressbookOpen(){
myAddressBook.setVisible(true);
myAdressBook.tree.requestFocus();
public void creatorOpen(){
myCreator.setVisible(true);
myCreator.tfTo.requestFocus();
public void actionPerformed(ActionEvent event){
Object obj = event.getSource();
if (obj instanceof JMenuItem){
String cmd = event.getActionCommand();
if (cmd.equals("New fetched")){
mailsfetch();
else if (cmd.equals("Written new mails")) {
creatorOpen();
else if (cmd.equals("Reply")) {
reply();
else if (cmd.equals("Forward")) {
forward();
else if (cmd.equals("Outbox")) {
sendOutbox();
else if (cmd.equals("Delete")) {
delete();
else if ((cmd.length() >13) &&
(cmd.substring(0,13).equals("Sorting-"))){
sorting(cmd);
else if (cmd.equals("Using Addressbook")){
addressbookOpen();
else if (cmd.equals("Filter working")){
filterOpen();
else if (cmd.equals("New Order")){
myFixTask.tf.setText("");
myFixTask.setVisible(true);
myFixTask.tf.requestFocus();
else if (cmd.equals("delete")){
delete();
else if ((cmd.length() >7) &&
(cmd.substring(0,7).equals("nobody"))){
if(viewSource == false){
viewSource = true;
menuNewSign();
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsRemark(index.mailId);
else{
viewSource = false;
menuNeuZeichnen();
if(tree.getLastSelectedPathComponent() != null){
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsRemark(index.mailId);
else if (cmd.equals("Setup")){
SetupOpen();
else if (obj instanceof JButton){
String cmd = event.getActionCommand();
if (cmd.equals("aga")){
mailsHolen();
else if (cmd.equals("Creator Open")){
creatorOpem();
else if(cmd.equals("rep")){
reply();
else if(cmd.equals("fwd")){
forward();
else if(cmd.equals("Setup Open")){
SetupOpen();
else if(cmd.equals("adr")){
addressbookOpen();
else if(cmd.equals("delete")){
delete();
else if(cmd.equals("Information")){
myInfo.setVisible(true);
myInfo.b.requestFocus();
private class myWindowListener extends WindowAdapter{
public void windowClosing(WindowEvent event){
end();
private class myTreeSelectionListener implements TreeSelectionListener{
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)(e.getPath().getLastPathComponent());
Object nodeInfo = node.getUserObject();
if(nodeInfo instanceof MailIndex){
MailIndex index = (MailIndex)nodeInfo;
mailsAnzeigen(index.mailId);
index.read = "Yes";
} -
Trouble compiling for printed documentation
hello, i am having trouble compiling a new document layout i
have created, i have followed peter grainges instructions on his
website but it always fails to generate straight away. Im using
Robohelp x5 with word 2000, does anyone have any ideas?
thanks steveSteve
Was RH installed on the PC you are using with you logon or
that of the person whose job you have taken over? It sounds very
much like the latter and this is exactly what I would expect to
happen.
Try creating a new project with just a couple of topics and
printing from that. It will likely also fail. If it does that
pretty much confirms my theory. Uninstall and reinstall RH with
your logon and with admin rights attached and the problem will
likely go away. -
Trouble compiling a stored procedure
Hello, I have trouble compiling a stored procedure. I include part of the code because I think the key problem is illustrated in these lines:
date1 is declared as a DATE.
index_value2 NUMBER;
BEGIN
date1 := (select sysdate from dual);
index_value2 := (select index_value from tmsdat.a_index_values where price_date < (SELECT sysdate -180
FROM dual) and price_date > (SELECT sysdate -210
FROM dual));
[\code]
The problem seems to be that a more complex syntax is included in the allocation statement (:=), can that be the case? That is, no select etc??
How is this solved?
Any help much appreciated!
best regards
HaraldWell, actually WhiteHat´s magic did the trick, but two errors:
temp := (select (to_number(to_char(sysdate, 'DD'))-1)/(decode(to_char(sysdate,'MM'),'02',28,30)) as result
from dual);
[\code]
this line generates problems but I think the approach is the same maybe, that is:
select to_number(to_char(sysdate, 'DD'))-1)/(decode(to_char(sysdate,'MM'),'02',28,30)) into temp as result frmo dual
Further, some error about encountering end of line?
END CONVERT_MARKET_INDEX; -
Create problem when compiling the servlet
hi,
i got a problem when i compile a servlet
when i try to compile the servlet, it shows that it could
not found the classes like httpservlet, etc.
means the classes of the servlet
i am using the j2sdk1.4.1 edition,
i had include the javax.servlet.*; in the program
please tell me what can be the problem & especially any solution for thatthe javax.servlet package and it's sub packages (javax.servlet.http, javax.servlet.jsp, javax.servlet.jsp.tagext) are not included with the Standard Edition. These packages are part of the Enterprise Edition. Check out this link for download:
http://java.sun.com/j2ee/sdk_1.3/ -
Can I complie a servlet with javac?
Im a new user, when i try to compile a servlet from javac myservlet.java
The compiler send several errors, it doesn't recognise the class of servlets.
My Enviroments' vars are:
PATH = C:\JDK1.4\BIN
CLASSPATH = .;C:\JBuilder8\thirdparty\jakarta-tomcat-4.1.12-LE-jdk14\common\lib\
I don't know if i'm doing wrong
I hope your answersYou need to add sevlet.jar to your classpath, which is located in TOMCAT_HOME/common/lib
-
I am a total newbie at programming and I am having trouble compiling. In the MS-DOS prompt, I located the folder where my .java file is located and typed the following:
javac SampleProgram.java
I received a "Bad command or file name" error. I am typing the names correctly. I am using Java 2 SDK, Standard Edition Version 1.3.1. Am I doing something wrong?
Thanks for any help.That should fix it. The problem is that DOS needs to know where to find the executable files like javac.exe
You can either set the path temporarily by typing
SET PATH=.;c:\jdk1.3.1\bin
at the command prompt each time you open a command window, or you can set it more permanently by adding it to your startup config. This will depend on your OS. On win 98 for example, there is an AUTOEXEC.BAT (usually with a SET PATH command already present). You could open this in notepad to add/change:
SET PATH=C:\WINDOWS
to
SET PATH=C:\WINDOWS;.;C:\JDK1.3.1\BIN
Reboot to make the changes take effect. Other OS's may have a special dialog to set this kind of command.
Hope this helps some. -
Compiling a Servlet that uses JavaBean
I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
--------------------Configuration: JDK version 1.3 <Default>--------------------
Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
symbol : class SimpleBean
location: class MyPackage.SimpleBean
SimpleBean simpleBean = (SimpleBean) session.getAttribute
^
("simpleBean");
C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
symbol : class SimpleBean
location: class MyPackage.SimpleBean
SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
^
2 errors
Process completed.
Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.Looks like an import Problem.
The Compiler is not able to "see" the SimpleBean Class.
Take care of the Classpath and your imports.
Happy Coding. :-) -
I am trying to compile a servlet using the import javax.servlet.*;
import javax.servlet.http.*; packages. But the only thing I keep getting is :
BasicServlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
BasicServlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
BasicServlet.java:6: cannot resolve symbol
symbol : class HttpServlet
location: class BasicServlet
public class BasicServlet extends HttpServlet
I have included the servletapi2_1_1-win package from the sun site containing the servlet.jar in my classpath. Still it refuses to compile. Besides does anybody know how to compile using the servlet packages available in Tomcat or j2ee, both of which I have on my machine , but can't figure what to include.
Please help.
^have you actually included the servlet.jar file in your classpath or just the directory, as you need to explicity declare jar files in the classpath...
javac -classpath %CLASSPATH%;C:\[servlet-jar-path]\servlet.jar Servlet.class -
Errors when compiling a servlet
I wrote a servlet named ShowRequestHeaders.java. Before I installed JDeveloper 3.2, I had already installed both standard 1.3 and enterprise 1.2.1 JDK. The source code looks like this:
package coreservlets;
import statement....
public class void Classname extends
HttpServlet {
But I got an error message:H:\Program Files\Oracle\JDeveloper 3.2\myprojects\welcome\ShowRequestHeaders.java
Error: (17) class HttpServlet not found in class coreservlets.ShowRequestHeaders.
what's wrong with this?
nullYou don't have the Servlets library in the JDeveloper project.
Open JDeveloper with the project having the servlet.
Open Project properties from menu Project|Project properties
Click on the Libraries tab.
Click Add
From the list choose "Servlet SDK" and click OK
Click OK in the project properties window.
Now compile your servlet.
raghu
Maybe you are looking for
-
How can I create and export a file in 1024x768? Is the size supported in FCPX?
I'm trying to create a video to export and upload on YouTube, and we want to do it at 1024x768. FCPX does not support this file size. Ideally how can I 1) Create a canvas size in 1024x768 (or the same aspect ratio) 2) Export my video at 1024x768 (her
-
Help with image selection/fade
Hi, I'm using Flash 8 and I'm a newbie to actionscript. I have to create a flash document that will allow me to swap out colors, patterns, and hardware on our collars. I found a thread posted here that was pretty much what I was looking for. I altere
-
I'll tryed many times. I searched this form (for 3 secret questions) in iTunes and on apple.com. There are only one question form that already filled long time ago. What i gonna do and why this happends?
-
Managing Photos in iPhoto and Folders
So I am embarrassed. I have been deleting photos in iPhoto and ASSuming they are deleted in their 'home' folder - nope. Is there any way to force iPhoto to be a file manager and any photos that are not in the app are deleted? For the future, is there
-
Oracle web tier install+config: opmn does not start after install
Centos 5 box. After a silent install of web tier 11.1.1.2 opmn will not start. The installation was "complete" but I found some errors in the various log files. When I try to start a process (for example) using opmn this error occurs in the log file: