Can't compile this sourcecode

why i can't compile this source code??
if i not mistaken the error like this "can't read bla..bla(i din't remember)"
(i've install all the java package..)
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;
import java.util.Hashtable;
* Date Servlet
* This is a simple servlet to demonstrate server-side include
* It returns a string representation of the current time.
* @author Scott Atwood
* @version 1.12, 08/29/97
public class DateServlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException
Date today = new Date();
res.setContentType("text/plain");
//getOutputStream ni aper?
ServletOutputStream out = res.getOutputStream();
out.println(today.toString());
public String getServletInfo() {
return "Returns a string representation of the current time";

Try it again. And this time write down the error message you get so you can ask a coherent question.

Similar Messages

  • Can't see why I can't compile this

    I can't seem to compile this code, and yet its supposed to because this is how our professor gave it to us on the website. Can anyone tell me what I need to make it compile? Thanks in advance.
    ArrayList list = new ArrayList(5);
    list.add(0, new Object());
    list.add(new Object());
    Object object = list.remove(1);
    ArrayList<Player> players = new ArrayList<Player>(10);
    class Player implements Comparable<Player> {
      public int compareTo(Player player) {
    class PlayerNameComparator implements Comparator<Player> {
      public int compare(Player player1, Player player2) {
    class MyStack {
      public int tos;
      public Comparable list[];
      // public ArrayList<Player> list;
      public MyStack() {
        tos = 0;
        list = new Comparable[10];
      public Comparable pop() {
        tos--;
        Comparable comparable = list[tos];
        list[tos] = null;
        return comparable;
      public void push(Comparable element) {
        list[tos] = element;
        tos++;
      public String toString() {
        String data = new String();
        MyStack temp = new MyStack();
        Comparable element = null;
        while (this.tos > 0) {
          element = this.pop();
          temp.push(element);
          data = data + element.toString();
        while (temp.tos > 0) {
          this.push(temp.pop());
    }

    The compiler always produces helpful messages which describe why text won't compile. If you can't understand them it would be a good idea to post those compiler messages.

  • I can't compile this, why?

    I do not possess any means of compiling any .java file that imports javax.* or anything J2SE-related, thus, I have to compile it remotely on a remote host (www.myjavaserver.com), however, for some reason this file will not compile but will not produce any errors, warnings, or any display of any kind - but no .class file is ever found.
    import java.io.*, java.util.*, javax.servlet.*, javax.servlet.http.*;
    * Borrowed from http://forum.java.sun.com/thread.jspa?threadID=703076
    * @access public
    * @author Phil Powell
    public class RequestParameterResetter extends HttpServletRequestWrapper {
        private HttpservletRequest origRequest;
        private Map<String, String> parameterMap;
        public RequestParameterResetter(HttpServletRequest request) {
            super(request);
            origRequest = request;
            parameterMap = new HashMap<String,String>();
        public String setParameter(String key, String value) {
            String oldValue = parameterMap.put(key,value);
            if (oldValue == null) oldValue = origRequest.getParameter(key);
            return oldValue;
        public String getParameter(String key) {
            String value = parameterMap.get(key);
            if (value == null) value = origRequest.getParameter(key);
            return value;
    }Could someone tell me what I'm missing in order for this to properly compile?
    Thanx
    Phil

    Sorry I can't do that, as much as I want to. My
    computer is very ancient and has too little memory to
    run any kind of server program, especially a
    Java-related one. I tried with Eclipse a while back
    (2 years ago and never figured it out, way too hard
    in spite of my PC's inability to interact with it)
    nearly destroyed my machine with it.You actually don't need to run any server. You just need to get the .JAR files (you should try to get the same server and version that you deploy on ... but that may not be possible). Then you put them in your Java Classpath, and you will be able to compile (from command line, or whatever). You could then un-install the server if you wanted to...
    >
    That means I can only compile J2SE formatted classes
    remotelyThat would be J2EE. J2SE is the standard edition, where you get the compiler, java.lang.String, java.util.Date, and all the rest of the core stuff. J2EE is the enterprise edition for getting the javax.servlet packages (among others).
    More comments on how you might change added as comments in the code...
    on www.myjavaserver.com - provided it is
    working.
    I made the changes necessary and still can't compile
    it!
    package ppowell;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * Borrowed from
    m
    http://forum.java.sun.com/thread.jspa?threadID=703076
    * @version JSDK 1.2
    The class is a Java 5.0 class, it won't compile to JSDK 1.2.
    Ask myjavaserver.com to see how you can get ahold of the error logs so you can see what messages are generated.
    * @author Phil Powell
    * @package PPOWELL
    public class RequestParameterResetter extends
    HttpServletRequestWrapper {
    private HttpServletRequest origRequest;
    private Map<String, String> parameterMap;//if you want to use non JSE 5.0, then this line should be:
    //        private Map parameterMap;
    >
    public
    blic RequestParameterResetter(HttpServletRequest
    request) {
    super(request);
    origRequest = request;
    parameterMap = new HashMap<String,String>();//if you want to use non JSE 5.0, then this line should be:
    //            parameterMap = new HashMap();
    public String setParameter(String key, String
    ring value) {
    String oldValue = parameterMap.put(key,value);//if you want to use non JSE 5.0, then this line should be:
    //        String oldValue = (String) parameterMap.put(key,value);
    if (oldValue == null) oldValue = origRequest.getParameter(key);
    return oldValue;
    public String getParameter(String key) {
    String value = parameterMap.get(key);//if you want to use non JSE 5.0, then this line should be:
    //            String value = (String)parameterMap.get(key);
    if (value == null) value =
    value = origRequest.getParameter(key);
    return value;

  • How come I can't compile this file in this folder,but can in others

    import java.util.*;
    public class AlphabeticComparator
    implements Comparator{
    public int compare(Object o1, Object o2) {
    String s1 = (String)o1;
    String s2 = (String)o2;
    return s1.toLowerCase().compareTo(
    s2.toLowerCase());
    this code can be compiled in any folders except
    e:\java\
    why??? the error is:
    --------------------Configuration: j2sdk1.4.0 <Default>--------------------
    E:\java\AlphabeticComparator.java:3: AlphabeticComparator should be declared abstract; it does not define compare(java.lang.Object,java.lang.Object) in AlphabeticComparator
    public class AlphabeticComparator
    ^
    E:\java\AlphabeticComparator.java:6: inconvertible types
    found : Object
    required: java.lang.String
    String s1 = (String)o1;
    ^
    E:\java\AlphabeticComparator.java:7: inconvertible types
    found : Object
    required: java.lang.String
    String s2 = (String)o2;
    ^
    3 errors
    Process completed.

    It looks like you have a class called "Object" in that same directory that the compiler is using when you use "Object", and then the compiler complains because it wasn't "java.lang.Object". Get rid of it -- you should have called it something else, anyway.

  • Help! I can't compile this program

    I copied the following program from E.Harold's book,Java Network Programming,online edition.The file name is SMTPClient.java.Its function is sending simple mails.
    When I compiled the file,there were 6 error messages indicating that the first 6 lines of code were wrong.The reasons are something like "class" or "interface" needed.
    Can anybody give me some advice?
    Source file:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class SMTPClient extends JFrame {
    private JButton sendButton = new JButton("Send Message");
    private JLabel fromLabel = new JLabel("From: ");
    private JLabel toLabel = new JLabel("To: ");
    private JLabel hostLabel = new JLabel("SMTP Server: ");
    private JLabel subjectLabel = new JLabel("Subject: ");
    private JTextField fromField = new JTextField(40);
    private JTextField toField = new JTextField(40);
    private JTextField hostField = new JTextField(40);
    private JTextField subjectField = new JTextField(40);
    private JTextArea message = new JTextArea(40, 72);
    private JScrollPane jsp = new JScrollPane(message);
    public SMTPClient() {
    super("SMTP Client");
    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel labels = new JPanel();
    labels.setLayout(new GridLayout(4, 1));
    labels.add(hostLabel);
    JPanel fields = new JPanel();
    fields.setLayout(new GridLayout(4, 1));
    String host = System.getProperty("mail.host", "");
    hostField.setText(host);
    fields.add(hostField);
    labels.add(toLabel);
    fields.add(toField);
    String from = System.getProperty("mail.from", "");
    fromField.setText(from);
    labels.add(fromLabel);
    fields.add(fromField);
    labels.add(subjectLabel);
    fields.add(subjectField);
    Box north = Box.createHorizontalBox();
    north.add(labels);
    north.add(fields);
    contentPane.add(north, BorderLayout.NORTH);
    message.setFont(new Font("Monospaced", Font.PLAIN, 12));
    contentPane.add(jsp, BorderLayout.CENTER);
    JPanel south = new JPanel();
    south.setLayout(new FlowLayout(FlowLayout.CENTER));
    south.add(sendButton);
    sendButton.addActionListener(new SendAction());
    contentPane.add(south, BorderLayout.SOUTH);
    this.pack();
    class SendAction implements ActionListener {
    public void actionPerformed(ActionEvent evt) {
    try {
    Properties props = new Properties();
    props.put("mail.host", hostField.getText());
    Session mailConnection = Session.getInstance(props, null);
    final Message msg = new MimeMessage(mailConnection);
    Address to = new InternetAddress(toField.getText());
    Address from = new InternetAddress(fromField.getText());
    msg.setContent(message.getText(), "text/plain");
    msg.setFrom(from);
    msg.setRecipient(Message.RecipientType.TO, to);
    msg.setSubject(subjectField.getText());
    // This can take a non-trivial amount of time so
    // spawn a thread to handle it.
    Runnable r = new Runnable() {
    public void run() {
    try {
    Transport.send(msg);
    catch (Exception ex) {
    ex.printStackTrace();
    Thread t = new Thread(r);
    t.start();
    message.setText("");
    catch (Exception ex) {
    // I should really bring up a more specific error dialog here.
    ex.printStackTrace();
    public static void main(String[] args) {
    SMTPClient client = new SMTPClient();
    // Next line requires Java 1.3 or later. I want to set up the
    // exit behavior here rather than in the constructor since
    // other programs that use this class may not want to exit
    // the application when the SMTPClient window closes.
    client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    client.show();
    Message was edited by:
    oscarhua

    1:install Java SE,set the path variable to the directory of the bin folder(including bin).
    2:download the JavaMail 1.4 release from http://java.sun.com/products/javamail/downloads/index.html
    3:extract the downloaded file to any location and add the directory of its mail.jar file to classpath.
    4:download the JavaBeans Activation Framework 1.1release from
    http://java.sun.com/products/javabeans/jaf/downloads/index.html#download
    5:extract the downloaded file to any location and add the directory of its activation.jar file to classpath.
    then everything goes smoothly
    You inspired me and voronetskyy told me exactly what to do,so thak both of you again!:-)
    Message was edited by:
    oscarhua

  • Can't Compile this!

    Hi guys,
    I am trying to establish development platform for my new website. I installed latest JDK and compiled small program which worked well. Then I installed Apache Tomcat and tried to do a small servlet test. This program is meant to display html test page saying "Hello world!":
    public class ServletTest extends HttpServlet
              public void doGet(
                   HttpServletRequest request,
                   HttpServletResponse response)
               throws ServletException, IOException
               response.setContentType("text/html");
               PrintWriter out = response.getWriter();
               String docType =
                       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
                       "Transitional//EN\">\n";
               out.println(docType +
                     "<HTML>\n" +
                    "<HEAD><TITLE>Hello WWW</TITLE></HEAD>\n" +
                    "<BODY>\n" +
                    "<H1>Hello World - Servlet speaking</H1>\n" +
                  "</BODY></HTML>");
    }Then I tried to compile it, but javax.servlet.http package can't be found:
    C:\>javac ServletTest.java
    ServletTest.java:5: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    ServletTest.java:6: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    ServletTest.java:8: cannot find symbol
    symbol: class HttpServlet
    public class ServletTest extends HttpServlet
                                     ^
    ServletTest.java:11: cannot find symbol
    symbol  : class HttpServletRequest
    location: class ServletTest
                            HttpServletRequest request,
                            ^
    ServletTest.java:12: cannot find symbol
    symbol  : class HttpServletResponse
    location: class ServletTest
                    HttpServletResponse response)
                    ^
    ServletTest.java:13: cannot find symbol
    symbol  : class ServletException
    location: class ServletTest
            throws ServletException, IOException
                   ^
    6 errorsMy user/system environment path variable goes to: C:\Program Files\Java\jdk1.6.0_10\bin
    My user/system environment classpath variable goes to: C:\Program Files\Java\jdk1.6.0_10\jre\lib
    What can cause this problem?

    Thanks for that...
    I found and downloaded: servletapi2_1_1-win.zip file which should contain the classes and source files for the Java Servlet 2.1.1 javax.servlet and javax.servlet.http packages
    Zipped folder contains:
    api and src folders
    in addition to that there are following files in zipped folder: license, readme, servlet.jar
    I have extracted all of that into my C:\Program Files\Java\jdk1.6.0_10 folder and then copied servlet.jar into C:\Program Files\Java\jdk1.6.0_10\jre\lib folder
    I tried to compile my ServletTest.jar but ther is still same error.
    Have I done everything right?

  • Newbie can't compile this

    Hi guys I'm a new Java programmer trying to learn this java thing. Anyway I have two classes in the same directory, class B compiles fine.
    Class A have a problem reaching the B file why is this? Code follows.
    /* B.java */
    public class B
         B()
              System.out.println("Inside B constructor");
    /* A.java */
    public class A
         A()
              System.out.println("Inside A constructor");
         public static void main(String[] args)
              A a = new A();
              B b = new B();
    When trying to compile A.java I get this error message.
    cannot find symbol
    symbol : class B
    location : class A
    B b = new B();

    Thank you for responding.
    I tried that before and I get the java options messages below.
    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
    show splash screen with specified image

  • I'm new to JasperReport. I can't compile this kind of report

    Hi, all
    I'm trying to create a report using Jasper Report. I already add the needed files into net bean classpath. And the compile task is successful. However when I run it, i meet the following message. And my app stucks there.
    net.sf.jasperreports.engine.JRException: Error compiling report java source files : C:\HuongLT\Misc\JavaApplication2\HelloReportWorld_1167289263828_654764.java
    at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93)
    at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
    at javaapplication2.Main.main(Main.java:44)
    Caused by: java.io.IOException: CreateProcess: javac -classpath "C:\Documents and Settings\Administrator\Desktop\jasperreports-1.2.8.jar;C:\Documents and Settings\Administrator\Desktop\commons-digester-1.8.jar;C:\Documents and Settings\Administrator\Desktop\commons-collections-3.2.jar;C:\Documents and Settings\Administrator\Desktop\commons-logging-1.1.jar;C:\Documents and Settings\Administrator\Desktop\commons-beanutils.jar;C:\HuongLT\Misc\JavaApplication2\build\classes" C:\HuongLT\Misc\JavaApplication2\HelloReportWorld_1167289263828_654764.java error=2
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
    at java.lang.Runtime.exec(Runtime.java:591)
    at java.lang.Runtime.exec(Runtime.java:464)
    at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
    ... 6 more
    Please help me.
    I appreciate very much for your help

    See Here...
    iCloud Backup and Restore Overview
    http://support.apple.com/kb/HT4859?viewlocale=en_US
    And Here...
    iCloud Help
    http://help.apple.com/icloud/?lang=en

  • Can't compile this code! can't tell why. Error message is below. Thanks

    import java.util.*;
    public class Library {
            private Collection books;                                               //Defining a collection of books here
            private Iterator bookIter;                                              //We want to iterate the collection of books here
            //Constructor to help us initialize our collection to hold elements of a newly created collection
            public Library() {
                    books = new ArrayList();                                        //Our collection holds a the newly created collection of type ArrayList (providing storage for books)
                    books.add(new Book("War and Crime"));
                    books.add(new Book("The Redeemers"));
            public void display() {
                    bookIter = books.iterator();
                    while (bookIter.hasNext()) {
                            Book aBook = (Book)bookIter.next();
                            System.out.println("Title : " + aBook.ret_title());
            public static void main(String args[]) {
                    display();
    class Book {
            private String title;
            Book(String b_title) {
                    this.title = b_title;
            public String ret_title() {
                    return this.title;
    }THIS IS THE ERROR:
    "Library.java" 105 lines, 3597 characters
    clio:~/javamachine/learning/topics/utils/Collection (Lord G.) % javac Library.java
    Library.java:91: non-static method display() cannot be referenced from a static context
    display();
    ^
    1 error
    Thanks for helping!
    BR,
    G-Afric

    Hi folkenf,
    I tried what you recommended already but the result was even more timidating.
    public static void display()ERROR OUTPUT NOW IS:
    Library.java:83: non-static variable bookIter cannot be referenced from a static context
    bookIter = books.iterator();
    ^
    Library.java:83: non-static variable books cannot be referenced from a static context
    bookIter = books.iterator();
    ^
    Library.java:84: non-static variable bookIter cannot be referenced from a static context
    while (bookIter.hasNext()) {
    ^
    Library.java:85: non-static variable bookIter cannot be referenced from a static context
    Book aBook = (Book)bookIter.next();
    ^
    4 errors
    I fixed this error by making books and bookIter static but now main() complains
    of null pointer as shown below:
    Runtime error:
    Exception in thread "main" java.lang.NullPointerException
    at Library.main(Library.java:89)
    Thanks!
    BR,
    G-Afric

  • I have previewed my book but after cliking BUY BOOK it compiles it OK but then it always states an error after of during uploading it to the store.  How can I rectify this?

    I have previewed my book but after cliking BUY BOOK it compiles it OK but then it always states an error after of during uploading it to the store.
    How can I rectify this?

    I have previewed my book but after cliking BUY BOOK it compiles it OK but then it always states an error after of during uploading it to the store.
    How can I rectify this?

  • I can't get this to compile.  Very simple.

    I'm having trouble compiling this code. Its saying that cannot find symbol variable PrintNumInEnglish. I have done everything that I know. Can you please help?
    import java.util.*;
    class Rooker_Ch4_1 {
    private void PrintNumInEnglish(int num)
    int tens, ones;
    // Extract the digit in the tens place and the ones place
    tens = num / 10;
    ones = num % 10;
    //Output 1-19
    switch (ones)
         case 19: System.out.print ("Nineteen");
         break;
         case 18: System.out.print ("Eighteen");
         break;
         case 17: System.out.print ("Seventeen");
         break;
         case 16: System.out.print ("Sixteen");
         break;
         case 15: System.out.print ("Fifteen");
         break;
         case 14: System.out.print ("Fourteen");
         break;
         case 13: System.out.print ("Thirteen");
         break;
         case 12: System.out.print ("Twelve");
         break;
         case 11: System.out.print ("Eleven");
         break;
         case 10: System.out.print ("Ten");
         break;
         case 9: System.out.print ("Nine");
         break;
         case 8: System.out.print ("Eight");
         break;
         case 7: System.out.print ("Seven");
         break;
         case 6: System.out.print ("Six");
         break;
         case 5: System.out.print ("Five");
         break;
         case 4: System.out.print ("Four");
         break;
         case 3: System.out.print ("Three");
         break;
         case 2: System.out.print ("Two");
         break;
         case 1: System.out.print ("One");
         break;
    // Output 20-90
    switch (tens)
    case 9: System.out.print("Ninety ");
    break;
    case 8: System.out.print("Eighty ");
    break;
    case 7: System.out.print("Seventy ");
                   break;
    case 6: System.out.print("Sixty ");
                   break;
    case 5: System.out.print("Fifty ");
                   break;
    case 4: System.out.print("Fourty ");
                   break;
    case 3: System.out.print("Thirty ");
                   break;
    case 2: System.out.print("Twenty ");
                   break;                                                  
    public static void main(String[] args) {
    int numOfLines;
    String another = "y";
    Scanner scan = new Scanner(System.in);
    while(another.equals("y"))
    System.out.print("\nEnter the number of verses of the i song to be printed: ");
    numOfLines = scan.nextInt();
    while(numOfLines < 0 || numOfLines > 100)
    System.out.print("Invalid input. Please enter a number between 0 and 100 (inclusive): ");
    numOfLines = scan.nextInt();
    for(int i = numOfLines; i > 0; i--)
    System.out.println("\n" + PrintNumInEnglish + " bottles of beer on the wall");
    System.out.println("\n" + PrintNumInEnglish + " bottles of beer");
    System.out.println("\nTake one down, pass it around.");
    System.out.println("\n" + (i - 1) + " bottles of beer on the wall");
    System.out.println("Again? (y/n): ");
    Edited by: Erooker on Oct 20, 2007 6:56 AM

    Erooker wrote:
    I'm having trouble compiling this code. Its saying that cannot find symbol variable PrintNumInEnglish. I have done everything that I know. Can you please help?well
    _#1_ for a start you could call the method the right way,it's declared to accept an int parameter, you're calling it as a variable
    _>>>>>>>>>declaration <<<<<<<<<<<_
    private void PrintNumInEnglish(int num)_>>>>>>>call <<<<<<<<<<<_
    System.out.println("\n" + PrintNumInEnglish + " bottles of beer on the wall");_#2_ your method is of type void that is returns nothing, while your call to the method expects a string back (or something else )
    _#3_ your method is declared as an instance method and you're calling it in a static context, so either:
    a- instatiate an object of type Rooker_Ch4_1 and call the method on it
    Rooker_Ch4_1 var = new Rooker_Ch4_1();
    var.PrintNumInEnglish(0);b- simply declare the method as static

  • Anyone can compile this program?Duke will be rewarded

    Anyone can help me compile this program..I try debugging a lot of time but it is not working!
    import java.lang.*;
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class ChatApplet extends Applet implements ActionListener,Runnable
    String user;
    String msg;
         public void init() {
              super.init();
              //{{INIT_CONTROLS
              setLayout(new BorderLayout(0,0));
              addNotify();
              resize(518,347);
              setBackground(new Color(12632256));
    msgbox = new java.awt.TextArea("",2,0,TextArea.SCROLLBARS_NONE);
              msgbox.setEditable(false);
    msgbox.disable();
    //msgbox.hide();
              msgbox.reshape(0,0,380,216);
              add(msgbox);
              idbox = new java.awt.TextField();
              idbox.reshape(84,288,284,24);
              add(idbox);
              button1 = new java.awt.Button("EnterRoom");
              button1.reshape(384,288,72,21);
              add(button1);
    list = new java.awt.List();
    //list.TOP_ALIGNMENT();
    //list.disable();
    list = new java.awt.List(5);
    list.add("#Default User"+"\n");
    list.reshape(384,24,128,196);
    list.setFont(new Font("Helvetica", Font.BOLD, 12));
    add(list);
              label2 = new java.awt.Label("Members");
              label2.reshape(396,0,100,19);
              add(label2);
              label1 = new java.awt.Label("UserName");
              label1.reshape(0,288,72,27);
              add(label1);
              textbox = new java.awt.TextField();
              textbox.reshape(84,240,431,44);
              add(textbox);
              label3 = new java.awt.Label("EnterText");
              label3.reshape(0,252,72,25);
              add(label3);
    //uf = new UserFrame();
              button1.addActionListener(this);
    idbox.addActionListener(this);
    textbox.addActionListener(this);
    list.addActionListener(this);
    public void actionPerformed(ActionEvent ae)
              if(ae.getSource()==idbox)
    user = idbox.getText()+"\n";
    list.addItem(user.trim());
    idbox.setText("");
                             msgbox.append(user+" HAS JOINED THE GROUP");
         if(ae.getSource().equals(button1))
    user = idbox.getText()+"\n";
    list.addItem(user.trim());
    idbox.setText("");
                             msgbox.append(user+" HAS JOINED THE GROUP");
    if(ae.getSource().equals(textbox))
    msg = textbox.getText();
    msgbox.append(msg+"\n");
    textbox.setText("");
    if(ae.getSource().equals(list))
    String l = list.getSelectedItem();
                             //uf.setTitle(l);
                             //Frame i[] = uf.getFrames();
                             //uf.setVisible(true);
    public void start()
    if(vt == null)
    vt = new Thread(this,getClass().getName());
    vt.start();
    public void run()
    try{
    for(int i=0;i<10;i++)
    msgbox.append("One stop Java source code - www.globalleafs.com"+"\n");
    msgbox.setForeground(Color.red);
    vt.sleep(30000);
    vt.resume();
    }catch(Exception e){e.printStackTrace();}
         java.awt.TextArea msgbox;
         java.awt.TextField idbox;
         java.awt.Button button1;
    java.awt.List list;
    java.awt.Label label2;
         java.awt.Label label1;
         java.awt.TextField textbox;
         java.awt.Label label3;
    private Thread vt;

    The program compiles over here. It just has some deprecation warnings ...or is that what you wanted debugged?
    Don't use reshape() ...I think in AWT you should now use setBounds();
    Don't use list.addItem(); ...looks like the API steers us to list.add();
    Don't use Thread.resume() ...I don't think there is a replacement (unneccessary?).
    Gee, this program must have ran the chat program in Ford's old model T ... !! (??)

  • Can someone else try to compile this and see why the program is returning..

    Can someone else try to compile this and see why the program is returning "false" when I try to delete the files on exit (at bottom of code)... I have the source code uploaded to the web as well as my 2 text test files inside a zip file(they need to be unzipped so you can try to test the program) and .class file... the program works the way i want it to, but i just can't seem to delete the 3 temporary files i use... why??? why does it return false???
    Thanks in advance,
    Disco Hristo
    http://www.holytrinity-holycross.org/DiscoHristo/Assemble.java
    http://www.holytrinity-holycross.org/DiscoHristo/Assemble.class
    http://www.holytrinity-holycross.org/DiscoHristo/tests.zip
    * Assemble.java 1.0 02/06/22
    * @author Disco Hristo
    * @version 1.0
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Assemble
         public static void main(String args[]) throws IOException
              if (args.length > 0) //     Checks to see if there are any arguments
                   printArgumentInfo ();
              else // if no arguments run the program
                   getInput ();
                   printToFile ();
                   deleteFiles ();
         public static void getInput () throws IOException
         //     Gets the input and then send it to 3 files according to Tags
              File head = new File ("head.chris");
    PrintStream headStream = new PrintStream (new FileOutputStream (head));
    File body = new File ("body.chris");
    PrintStream bodyStream = new PrintStream (new FileOutputStream (body));
    File foot = new File ("foot.chris");
    PrintStream footStream = new PrintStream (new FileOutputStream (foot));
    String input; //     String used to store input                
    File d = new File(".");
    String files[] = d.list();
    for (int n=0; n!=files.length; n++)
         if (files[n].endsWith(".txt") == true)
              String fileName = files[n];
              BufferedReader in = new BufferedReader (new FileReader(fileName));
                   while (true)
                   input = in.readLine();
                   if (input != null)
                        input = input.trim();
                        if (input == null) // if no more input                          
                             break;
                        else if ( (input.compareTo("<HEAD>")) == 0) // if start of <HEAD> text
                             do
                                  input = in.readLine();
                                       if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<BODY>")) == 0) ||
                                                      ((input.compareTo("<FOOT>")) == 0) ||
                                                      ((input.compareTo("</BODY>")) == 0) ||
                                                      ((input.compareTo("</FOOT>")) == 0) ||
                                                      ((input.compareTo("<HEAD>")) == 0))
                                                      //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <HEAD> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</HEAD>")) != 0) //if not end of tag
                                            headStream.println(input); //print to text file
                             while ( (input.compareTo("</HEAD>")) != 0);
                        else if ( (input.compareTo("<BODY>")) == 0) // if start of <BODY> text
                             do
                                  input = in.readLine();
                                  if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<HEAD>")) == 0) ||
                                                      ((input.compareTo("<FOOT>")) == 0) ||
                                                      ((input.compareTo("</HEAD>")) == 0) ||
                                                      ((input.compareTo("</FOOT>")) == 0) ||
                                                      ((input.compareTo("<BODY>")) == 0))
                                                      //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <BODY> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</BODY>")) != 0) //if not end of tag
                                            bodyStream.println(input); //print to text file
                             while ( (input.compareTo("</BODY>")) != 0);
                             else if ( (input.compareTo("<FOOT>")) == 0) // if start of <FOOT> text
                                  do
                                  input = in.readLine();
                                  if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<BODY>")) == 0) ||
                                            ((input.compareTo("<HEAD>")) == 0) ||
                                                 ((input.compareTo("</BODY>")) == 0) ||
                                                 ((input.compareTo("</HEAD>")) == 0) ||
                                                 ((input.compareTo("<FOOT>")) == 0))
                                                 //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <FOOT> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</FOOT>")) != 0) //if not end of tag
                                                 footStream.println(input); //print to text file
                             while ( (input.compareTo("</FOOT>")) != 0);
                   else
                        break;
    public static void printToFile () throws IOException
    // Prints the text from head.txt, body.txt, and foot.txt to the output.log
         File head = new File ("head.chris");
         FileReader headReader = new FileReader(head);
              BufferedReader inHead = new BufferedReader(headReader);
              File body = new File ("body.chris");
              FileReader bodyReader = new FileReader(body);
              BufferedReader inBody = new BufferedReader(bodyReader);
              File foot = new File ("foot.chris");
              FileReader footReader = new FileReader(foot);
              BufferedReader inFoot = new BufferedReader(footReader);
              PrintStream outputStream = new PrintStream (new FileOutputStream (new File("output.log")));
              String output;     //string used to store output
              while (true)
                   output = inHead.readLine();
                   if (output == null) //if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              while (true)
                   output = inBody.readLine();
                   if (output == null)// if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              while (true)
                   output = inFoot.readLine();
                   if (output == null) //if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              //Close up the files
              inHead.close ();
              inBody.close ();
              inFoot.close ();
              outputStream.close ();     
         public static void printArgumentInfo () //     Prints argument info to screen
              System.out.println("");
              System.out.println("Disco Hristo");
              System.out.println("");
              System.out.println("Assemble.class is a small program that");
              System.out.println("takes in as input a body of text and then");
              System.out.println("outputs the text in an order according to");
              System.out.println("the tags that are placed in the input.");
         public static void deleteFiles ()
              File deleteHead = new File ("head.chris");
              File deleteBody = new File ("body.chris");
              File deleteFoot = new File ("foot.chris");
              deleteHead.deleteOnExit();
              deleteBody.deleteOnExit();
              deleteFoot.deleteOnExit();
    }

    I tired your program, it still gives false for files deleted. I tool the same functions you used in your program and ran it. The files get deleted. Tried this :
    <pre>
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class FileTest {
         public static void main(String args[]) {
              FileTest f = new FileTest();
              try {
                   f.createFile();
                   f.deleteFile();
              } catch(IOException ioe){
                   System.out.println(ioe.getMessage());
         public void createFile() throws IOException {
              System.out.println("In create file method...");
              File test = new File("test1.txt");
              File tst = new File("text2.txt");
              PrintStream testStream = new PrintStream (new FileOutputStream (test));
              PrintStream tstStream = new PrintStream (new FileOutputStream (tst));
              testStream.println("this is a test to delete a file");
              tstStream.println("this is the second file created");
              testStream.close();
              tstStream.close();          
         public void deleteFile() throws IOException {
              File test = new File("test1.txt");
              File tst = new File("text2.txt");
              System.out.println(test.delete());
              System.out.println(tst.delete());
    </pre>
    Also check the starting and closing braces for your if..else blocks.
    -Siva

  • I can't compile any project...

    Hello,
    I installed Alchemy correctly, but when I try too compile my project, I always get this error message :
    I don't understand why, since llvm-stub.exe is in the same folder as llvm-ld.
    I'm using Alchemy with Cygwin btw.
    Thanks in advance for you help

    I'm not to familiar with fmod, but it would look like from the web page that it's a library (in windows it would be a dll I asume) that you can make calls to.  If that's they case, Alchemy is not for you.
    Alchemy does not do anything that you can't do in the FlashPlayer / Air runtimes.
    Alchemy does not generate platform bytecode.
    Alchemy does generate FlashPlayer bytecode.
    Alchemy does not get arround the FlashPlayer sandbox.
    Alchmey let's you port C/C++ code and turn it into FlashPlayer bytecodes.
    If you have the sourcecode for fmod and you wish to compile the sourcecode, you can, but you will NOT have direct access to the hardware, that goes against the principle of Flash security sandbox.
    That said... there are future things comming up, which I unfortunately can't disclose, that might help you with that plan in the near future, but it sounds like you have the wrong concept of what Alchemy is.
    Whatever problem is that you are having, it's in your setup.  There is no "magic", it works out of the box if you follow the steps properly, so if you did, then it might be something in your system that is causing the conflict.
    As an observation:
    if you get a "The file exists" error when you are creating the symbolic link, then that's probably your problem.
    As stupid as this sounds, make absolutely 100% sure that you DID remove the llvm-stub.exe file before you create the symbolic link again, and make sure that you are in the right directory when you do so.  You should NOT get "The file exists" error when creating the link.
    BTW. that would have nothing to do with Alchemy, but more with cygwin.
    You have no idea how many IT certified [InsertWhateverHere] experts have I told to check the basics, which they asure me they have, and when I go step by step, it turns out to be something basic.
    Sometimes you are looking to blame something else, and miss the obvious.

  • When I download a CD to iTunes, some CD's appear as separate albums. How can I correct this?

    When I download a CD to iTunes, some CD's appear as separate albums. How can I correct this?
    for some reason iTunes appears to believe some tracts are from a separate album. For instance, one recently released Rod Stewart CD HAS 8 tracts on one album and the remaining two tracts on two separate albums, all albums are called the correct album name?

    If your CD has tracks with different artists, or if there are differences in how the artist field is filled in for the different tracks, then you can fix this by identifying the disc as a 'compilation' CD.
    Select all of the tracks in the CD, then 'get info' (control-I), and go to 'Options'. Select 'yes' for 'Part of a compilation'. That should fix the problem.

Maybe you are looking for

  • Looking up a custom work manager

    Hi All, I'm a little stumped with accessing a custom work manager in WLS 9.2. I think I've followed the docs exactly. I tried to use the default wm by looking up "java:comp/env/wm/default" and that worked fine. I didn't in any was define that in any

  • Migrated to new comp, now Air Won't Preview from Dreamweaver

    Hi all, I'm on a mac and have migrated over to a new computer. Air has decided it won't preview from dreamweaver. I'm 99% sure this is due to a path issue /usrname vs /newusrname with dreamweaver exten finding the ADL or whatever the exten calls to p

  • How do I turn off automatic updates?

    How do I turn off automatic updates on a Galaxy S5? I would like to select manually the updates I want.

  • Seeing Query in Microsoft Explorer

    Hello All, I am working on a new system install (3.5) and when I try and launch the report in the web (microsoft explorer) it fails to do so. does anyone know what setting needs to be made to be able to see the reports in the wed format. Thanks Bryn

  • Can't find my iPhoto Library on Aperture

    I just downloaded Aperture and couldn't wait to see my iPhoto Library in the new Aperture. But when I opened Aperture the photos shown in the Library are old photos (5,000+) that I have deleted from my iPhoto Library. In fact nothing newer than 2009