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;

Similar Messages

  • 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.

  • 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.

  • 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.

  • 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

  • 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

  • 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

  • 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?

  • I can not stop this why, It continues to appear what do I do

    A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
    Script: resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/browser/extensions/%7B82AF8DCA-6DE9-405D-BD5E-43525BDAD38A%7D.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://skype_ff_extension-at-jetpack/skype_ff_extension/data/jquery-2.1.0.min.js:26

    That is a problem with the Skype extension for Firefox (skype_ff_extension).
    See:
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • 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

  • In 3.8 multiple tabs could be saved on closing, in 8.0.1 I can't do this, why not, and is there a fix?

    in 3.8 multiple tabs could be saved on closing, in 8.0.1 it doesn't appear to be available. Is there a fix or workaround?

    Go to '''TOOLS''' then '''OPTIONS ''' then '''GENERAL''' panel in '''START UP''' session scroll and choose '''Show my windows and tabs from last time''' then click OK to save it exit firefox and restart-it.
    for more info : [https://support.mozilla.org/en-US/kb/Options%20window%20-%20General%20panel#w_startup Options window - General panel - Startup ]
    see also : [https://support.mozilla.org/en-US/kb/Session%20Restore Session Restore]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • 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

  • How can i fix my iphone i can't update or download apps, when i try it tells me toput my credit card info and i do but when i push done it tells me my payment has been declined, but why do i have to pay to update or download free apps. How can i fix this?

    how can i fix my iphone i can't update or download apps, when i try it tells me toput my credit card info and i do but when i push done it tells me my payment has been declined, but why do i have to pay to update or download free apps. How can i fix this?

    You must contact iTunes support to get the problem resolved.
    http://www.apple.com/support/itunes/contact/
    If there is a problem with your account or payment info, you cannot
    download anything (including free apps or updates) until the matter
    is resolved.
    In countries where the iTunes Store only sells apps, the accepted payment methods are Visa, MasterCard, and American Express. Other payment types such as gift cards, store credit, monthly allowances, ClickandBuy, and PayPal are not accepted. Depending on your App Store country, prices may be listed in your local currency, US Dollars, or Euros.    http://support.apple.com/kb/HT5552

  • Can you tell me why none of my music will play I had a little box that came up saying all your items are ticked so they will not play on itunes what does this mean it's driving me nuts help!!!

    HI there can you tell me why none of my music will play on itunes it just displays a message saying it cannot be located please help it is driving me nuts
    Jan

    About 5 days ago for no apparent reason at all, about
    7000 songs which i have collected over a number of
    years has just decided that it wont play in ITUNES or
    in any other of my media players. When you click on
    Play over a song nothing happens. The play icon
    doesnt even come up on the screen.
    Steps I have taken so far are:
    1 - Remove all tracks from ITUNES and then re-add the
    folder where all the songs are. This has obviously
    removed all songs, but when I have re-added the
    folder , it has added about 650 tracks back on to the
    playlist. These 650 tracks will play. This leaves
    approx 6400 tracks that it wont play.
    By the way all the songs on my PC are MP3 type and I
    have had no problem playing any of them until last
    week.
    2 - I have re-installed ITUNES and reinstalled
    Quicktime and that has not worked.
    3 - All of my songs are backed up on to a External
    Hard Drive. I have tried to restore the songs and
    also play them directly from the external hard drive.
    I get the same problem when I do this.
    4 - I have enabled and allowed all permissions for
    the account that I am running the PC from.
    I am guessing there must be some settnig or Registry
    Key that is blocking me playing the tracks from the
    PC. I have also tried to launch the songs in Media
    Player and Sonic stage but thsi has not played
    either.
    All the tracks are in the folder structure as they
    were before so I know they are there. I just need to
    somehow unlock them.......
    If anyone has any ideas, I would be very grateful as
    I dont want to lose my entire music collection.
    Also I cannot find anyweher on here that is a Support
    number or email address for Apple as this is an
    ITUNES issue and they should be resolving it for
    me!!!!
    Thanks
    Dell   Windows XP
    Pro  

  • When I connect my iPhone 5 to my laptop and iTunes, I can't play movies from the iPhone on my computer.Why is that? Can I do this or it's not possible with iPhone5? With my iPod it's no problem.

    When I connect my iPhone 5 to my laptop and iTunes, I can't play movies from the iPhone on my computer.Why is that? Can I do this or it's not possible with iPhone5? With my iPod it's no problem.

    Reinstall iTunes. Make sure you follow the instructions in this support document to the letter. http://support.apple.com/kb/HT1923.
    You may have some problems because Apple has not certified that everything works with Windows 8 yet.

Maybe you are looking for

  • Org unit reporting to multiple Org units

    Hi,      We have set the A002 relationship as time constraint 002 and the B002 is set up as time constriant 3 but we are still able assign the org unit to report to multiple org units. Can you please let me know how to fix this issue. Thanks Vick

  • Digital device to use to measure 3.3V logic with 5k pull-up and 10k series resistance

    I have a digital instrument with the setup that is shown below.  I wish to measure the logic state of the line with a National Instruments device.  Which one do you recommend?   Trials and Failures: I tried using the usb-6501 but because of the 5V an

  • R12 and OAF settings

    Hi All, Could anybody please explain me how the OAF customizations are setup in R12 ? Earlier we were using the jserv.properties file. Seems like this file is not there in R12. Any clue on what replaces jserv.properties ? Also, will be of great help

  • How can I make a custom tone?

    I want to make a song from my itunes library into a tone without paying.

  • Script creation from table

    how to create a script of table that table exist in database. like i have a script create table emp empno number, ename varchar2(10) from this script i have create a table in database but after some time i lost this script and table still exist in da