Output to a text file in an applet...

i can't figure out how to do output to a text file in an applet... i've gotten output in applications, but nto applets. if someone can give me a link to a site that explains this, i would be much appreciative.

There is no easy way, since accessing Files with write permissions is a security issue. You can sign the JAR your applet is in, and use Security managers to try and get around it, but it is quite complicated I believe.
Do a search for Security Signed Applets etc...

Similar Messages

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • Exporting to a text file in an applet..

    Hey all,
    I've been working on an applet for simulating different nodal configurations on a 2D map. What I need to be able to do is export, on the click of a button, all of the nodal coordinates (x,y) to a text file. However, using the standard FileWrite hasn't been working for me. The code compiles and the applet runs fine, but I haven't been able to create the text file on the click of a button. Any ideas?
    Here's what I've got so far. Basically, on the button push, it's supposed goes through an array of ellipses (what I use for nodes) and gets the x and y coords for each and output them to a text file. The applet doesn't freeze or anything when I push the button either, it just does nothing.
    void stop_actionPerformed(ActionEvent e){
                try
                        String fileName = "NodeCoords.txt";
                        FileWriter fileWriter = new FileWriter( fileName );
                        BufferedWriter bufferedWriter = new BufferedWriter( fileWriter );
                        String tmpCoordinates;
                        int ID;
                        //for looop through x-y coordinates
                        for (int i = 0; i < node.length; i++){
                            ID = i+1;
                            tmpCoordinates = "Node: " + String.valueOf(nodeID[ID]) + "  X: " + String.valueOf(node.getX()) + " Y: " + String.valueOf(node[i].getY()) + "\n";
    bufferedWriter.write(tmpCoordinates);
    bufferedWriter.close();
    catch( IOException p )
    p.printStackTrace();

    I'm new to this type of programming. This is for simulation of a new MAC protocol that I've worked on, and is basically just serving as a visual. If I knew how to create a stand alone application that looks like the applet I would have...

  • Not able to save report output in a text file and RTF file

    I am using Oracle Developer6.0 . I am facing problem with reports. I am invoking reports from form using run_product.
    1. I could not able to save the report in text file . Whenever i try to save the report output in a text file.It gives dump and application get closed.
    2. In RTF format , it execute the query which i have given at the design time while creating a report . But while running i am passing query either through lexical parameter or passing value of where criteria user parameters. It display the output for the specified value. But when i save this report output in rtf file . It execute design time query and save that in a rtf file.
    If any body is having any idea about it . Please let me ASAP . It is very urgent for me.
    Thanks in advance

    Try the following:
    Do not generate the report to .rep file, but rename/copy the .rdf file to .rep file and execute it.

  • WebLogic writes to a text file and an applet reads the text file

    Hi there,
    I need some help here!
    I have an applet that needs to read from a text file:
    final URL prtDataURL = new URL("http://" + getCodeBase().getHost() + ":" + getCodeBase().getPort() + "/ESTC/lib/prtDataFile.txt");
                final URLConnection urlConn = prtDataURL.openConnection();
                urlConn.setUseCaches(false);
                urlConn.setDoInput(true);
                urlConn.setDoOutput(false);
                final InputStreamReader is = new InputStreamReader(urlConn.getInputStream());
                final BufferedReader in = new BufferedReader(is);
                String inputLine;
                while ((inputLine = in.readLine()) != null){
                    String[] tmp = inputLine.split("§");
                    this.dateTime = tmp[0];
                    this.quanTot = Integer.parseInt(tmp[1]);
                    this.quanSco = Integer.parseInt(tmp[2]);
                    this.quanSef = Integer.parseInt(tmp[3]);
                    this.valTot = Double.parseDouble(tmp[4]);
                    this.valSco = Double.parseDouble(tmp[5]);
                    this.valSef = Double.parseDouble(tmp[6]);
                in.close();
                is.close();and this is ok.
    Now I have the web server (WebLogic) that must write, at regular time intervals, to that file (prtDataFile.txt). The web application writes to the file (which belongs to the application).
    I've tried open the file with the File object but since the war file is unexploded I can't get the real path!
    I've tried open an url connection,
    final URL url = new URL("http://10.191.33.249:16801/ESTC/lib/prtDataFile.txt");
    final URLConnection connection = url.openConnection();
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    connection.setDoInput(false);
    OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
    out.write(currentDate + "§" + quantTot + "§" + quantSco + "§" + quantSef + "§" + valTot + "§" + valSco + "§" + valSef);;
    out.flush();
    out.close();which seems a little stupid since I'm opening an URLConnection to the same place where the application is. Anyway it doesn't work, i.e., it doesn't write to the file but it doesn't gives me any errors or exceptions.
    Is there another way to get this two pieces communicating?
    Thanks in advance

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • Outputting to a text file.

    Hey guys and gals,
    Im doing a program for work that is a form you type in, select save and it stores the data to a file. I have 2 problems. FIRST i need to know how to change the font. SECOND how do i put in tabs, returns using out.write(...);
    The goal is to output a form to a text file that can be saved, printed. Right now it all runs together in the .txt or .doc file that it makes.
    thanks bunches
    package hrform;
    // imports
    import java.awt.Font;
    import java.awt.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.event.*;
    import java.awt.Font;
    public class form extends JFrame implements ActionListener
    //declare text boxes, buttons, radiobuttons
    private JRadioButton jrbThree, jrbSix;
    //private ButtonGroup btg = new ButtonGroup();
    private JButton jbtSave;
    private JTextField jtfEmployee, jtfDateofhire;
    private JTextField jtfDatecompleted, jtfJobtitle;
    private JFileChooser jFileChooser = new JFileChooser();
    private JTextField jtfCurrentpay, jtfDateofincrease, jtfAmount;
    private JTextField jtfAcceptible, jtfExemplary, jtfImprovement, jtfDependability;
    private JTextField jtfPersonality, jtfGoals;
    /** Main Method*/
    public static void main(String [] args)
    form frame = new form();
    //frame.setDefault(closeOperation(JFrame.EXIT_ON_CLOSE));
    frame.setSize(800,580);
    frame.setVisible(true);
    /**Default Constructor*/
    public form()
    Color defaultColor = Color.red;
    setTitle("Employee Evaluation Form");
    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
    setColor (Color.lightGray);
    p1.add(new JLabel("Employee Name:"));
    p1.add(jtfEmployee = new JTextField(11));
    p1.add(new JLabel("Date of Hire:"));
    p1.add(jtfDateofhire = new JTextField(10));
    p1.add(new JLabel("Date Completed by Employee"));
    p1.add(jtfDatecompleted = new JTextField(10));
    // panel p2 for radio buttons
    JPanel p2 = new JPanel();
    p2.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
    p2.add(new JLabel("Job Title: "));
    p2.add(jtfJobtitle = new JTextField(20));
    p2.add(new JLabel("Current Rate of Pay"));
    p2.add(jtfCurrentpay = new JTextField(10));
    p2.add(new JLabel("Date of Last Increase: "));
    p2.add(jtfDateofincrease = new JTextField(8));
    p2.add(new JLabel("Amount of Last Increase: "));
    p2.add(jtfAmount = new JTextField(70));
    p2.add(new JLabel("Has displayed an acceptable level of performance these areas: "));
    p2.add(jtfAcceptible = new JTextField(70));
    p2.add(new JLabel("Has shown EXEMPLARY performace in these areas: "));
    p2.add(jtfExemplary = new JTextField(70));
    p2.add(new JLabel("Areas for Improvement: "));
    p2.add(jtfImprovement = new JTextField(70));
    p2.add(new JLabel("Dependability(Focus on attendance, punctuality, and attentiveness): "));
    p2.add(jtfDependability = new JTextField(70));
    p2.add(new JLabel("Personality(Focus on ability to work for and with others): "));
    p2.add(jtfPersonality = new JTextField(70));
    p2.add(new JLabel("GOALS FOR NEXT QUARTER: "));
    p2.add(jtfGoals = new JTextField(70));
    p2.add(jbtSave = new JButton());
    jbtSave.setText("Save");
    //set default directory
    jFileChooser.setCurrentDirectory(new File("F:WPDOCS/Personne"));
    //Set flowlayout for the fram
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(p1, BorderLayout.NORTH);
    getContentPane().add(p2, BorderLayout.CENTER);
    // Register Listeners
    jbtSave.addActionListener(this);
    /** Handle event */
    public void actionPerformed(ActionEvent e)
    String actionCommand= e.getActionCommand();
    if (e.getSource() instanceof JButton)
    if ("Save".equals(actionCommand))
    Save();
    /** Save file*/
    private void Save()
    if(jFileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
    Save(jFileChooser.getSelectedFile());
    private void Save(File file)
    try
    Font helv = new Font("Helvetica", Font.BOLD, 16);
    Font courier = new Font("Courier", Font.BOLD, 24);
    Color defaultColor = Color.cyan;
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    out.write(new JLabel(" ").getText().getBytes());
    //out.setFont("SansSerif",Font.BOLD,14);
    out.write(new JLabel("TMC Orthopedic - EMPLOYEE PERFORMANCE EVALUATION").getText().getBytes());
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Employee Name: ").getText().getBytes());
    byte[] b = (jtfEmployee.getText()).getBytes();
    out.write(b,0,b.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Date of Hire: ").getText().getBytes());
    out.write(new JLabel().getText().getBytes());
    byte[] c = (jtfDateofhire.getText()).getBytes();
    out.write(c,0,c.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Date Completed by Employee: ").getText().getBytes());
    //out.writeChars(\n);
    byte[] d = (jtfDatecompleted.getText().getBytes());
    out.write(d,0,d.length);
    byte[] e = (jtfJobtitle.getText().getBytes());
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Job Title: ").getText().getBytes());
    out.write(e,0,e.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Current Pay: ").getText().getBytes());
    byte[] f = (jtfCurrentpay.getText().getBytes());
    out.write(f,0,f.length);
    out.write(new JLabel(" ").getText().getBytes());
    byte[] g = (jtfDateofincrease.getText().getBytes());
    out.write(new JLabel("Date of Last Increase: ").getText().getBytes());
    out.write(g,0,g.length);
    out.write(new JLabel(" ").getText().getBytes());
    byte[] h = (jtfAmount.getText().getBytes());
    out.write(new JLabel("Amount Of Last Increase").getText().getBytes());
    out.write(h,0,h.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Has displayed an acceptable level of performance in these areas: ").getText().getBytes());
    byte[] i = jtfAcceptible.getText().getBytes();
    out.write(i,0,i.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Has displayed an exemplary level of performance in the following areas: ").getText().getBytes());
    byte[] j = jtfExemplary.getText().getBytes();
    out.write(j,0,j.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Areas for improvement").getText().getBytes());
    byte[] k = jtfImprovement.getText().getBytes();
    out.write(k,0,k.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Dependability(Focus on attendance, punctuality, and attentiveness): ").getText().getBytes());
    byte[] l = jtfDependability.getText().getBytes();
    out.write(l,0,l.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("Personality (Forcus on ability to work for and with others): ").getText().getBytes());
    byte[] m = jtfPersonality.getText().getBytes();
    out.write(m,0,m.length);
    out.write(new JLabel(" ").getText().getBytes());
    out.write(new JLabel("GOALS FOR NEXT QUARTER: ").getText().getBytes());
    byte[] n = jtfGoals.getText().getBytes();
    out.write(n,0,n.length);
    out.close();
    catch(IOException ex)

    I tried both of these and i get an error.
    "form.java": Error #: 300 : method write(java.lang.String) not found in class java.io.BufferedOutputStream at line 136, column 15
    Do i need to include something else???
    Thanks
    To insert a tab, use out.write("\t"). To insert a newline (crossplatform), use out.write(System.getProperty("line.separator")).
    HTH!
    :o)

  • Problem with alv output export to text file

    hi experts,
    when iam exporting alv output to text file,
    some data is missing in text file.say for example sold-to-party value is 1155027 in alv out put,but in text file it is showeing only 115502 ,
    the last digit is missing,
    can anyone help urgent!!!!!

    and when you export it to excel?
    from here you could save it as text file too...
    A.

  • Saving SQL+ output to a text file

    I have to use SQL+ on one of my databases. No way around it. So I will write my queries, run them, check the output, tweak them and run again as necessary. So I might start with
    SELECT
    ename,
    job
    FROM
    emp;Once I know it is working correctly, I wrap it in a procedure so I can get the data in a text file:
    SET TRIM ON
    SET PAGESIZE 2000
    SET SERVEROUTPUT ON SIZE unlimited
    EXEC DBMS_OUTPUT.ENABLE(null)
    SPOOL c:\mySQL\out.txt
    BEGIN
    DECLARE
    CURSOR c_cur IS
    SELECT
    ename,
    job
    FROM
    emp;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(
    'NAME|JOB|'
    FOR r_cur IN c_cur LOOP
    DBMS_OUTPUT.PUT_LINE(
    r_cur.ename||'|'||
    r_cur.job
    END LOOP;
    END;
    END;
    /Then I import this into Excel as delimited data on the pipe |
    which works great until I decide that I actually do need one more column. Then I have make changes to the SQL, and two more changes in the output portion (one for the heading, and one for the LOOP)
    I was wondering if anyone had written a cool procedure that I could run ANY SQL through, and it would automatically know my column names write the headings and then loop through the data automatically.
    I'm not tied to using the exact procedure I described above. The key is, I am looking for a general procedure that I can run any script through, and it will handle the output for me, without additional modification.

    MrGibbage wrote:
    I have to use SQL+ on one of my databases. No way around it. So I will write my queries, run them, check the output, tweak them and run again as necessary. So I might start with
    SELECT
    ename,
    job
    FROM
    emp;Once I know it is working correctly, I wrap it in a procedure so I can get the data in a text file:
    SET TRIM ON
    SET PAGESIZE 2000
    SET SERVEROUTPUT ON SIZE unlimited
    EXEC DBMS_OUTPUT.ENABLE(null)
    SPOOL c:\mySQL\out.txt
    BEGIN
    DECLARE
    CURSOR c_cur IS
    SELECT
    ename,
    job
    FROM
    emp;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(
    'NAME|JOB|'
    FOR r_cur IN c_cur LOOP
    DBMS_OUTPUT.PUT_LINE(
    r_cur.ename||'|'||
    r_cur.job
    END LOOP;
    END;
    END;
    /Then I import this into Excel as delimited data on the pipe |
    which works great until I decide that I actually do need one more column. Then I have make changes to the SQL, and two more changes in the output portion (one for the heading, and one for the LOOP)
    I was wondering if anyone had written a cool procedure that I could run ANY SQL through, and it would automatically know my column names write the headings and then loop through the data automatically.
    I'm not tied to using the exact procedure I described above. The key is, I am looking for a general procedure that I can run any script through, and it will handle the output for me, without additional modification.Why are you bothering with the PL/sql procedure at all? Why not just
    SET TRIM ON
    SET PAGESIZE 2000
    SPOOL c:\mySQL\out.txt
    SELECT
    ename,
    job
    FROM
    emp;
    spool off

  • Report output in a text file

    Hello,
    I am using report 6i and I would like to have the output of my report in a file, such as text file.
    I tried with the systems parameters (DESNAME, DESTYPE ...) but it dosent work.
    Does someone could help me with that?
    Thankyou in advance.

    Hi,
    I had tried to do that before. When you write to a file oracle reports create a .lis file containing printer fonts, which is no good. What you can do is define a printer using ascii drivers and use that printer to write to a file inorder to get a text file.
    The other thing I did is used DDE techniques to write the report to .xls file. The online help on reports have good examples on how to do this.
    Hope this helps. Good Luck!

  • Formatting output to a text file (using FileWriter and PrintWriter)

    Hi Folks
    I am using the bit of code below to save output from a gui to a text file. The data is entered line by line in the form eg,
    "one two three four"
    "five six seven eight"
    I am also reloading this data back in to a TextArea in the GUI for viewing if required. The annoying thing that upon reloading, the data appears in one long line. The TextArea does not offer a line wrapping facilty (well I don't know how to impement it, it exist). Consequently, I would be quite grateful if somone could come come to my assistance. Any of these would graciously appreciated:
    1. Forcing the TextArea to word wrap
    2. Manually inserting some type of newline character at the end of the outbound
    text
    3. Or any other procedure you experts can dream up :-)
    Cheers
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == loadButton) {
    getFileDialog = new FileDialog(this,
    "Select or enter the name of the file you wish to write to.",
    FileDialog.LOAD);
    getFileDialog.setDirectory("C:\\Work\\java_tutorials");
    getFileDialog.show();
    fileName = getFileDialog.getFile();
    if(fileName == null) {
    return;
    directory = getNameBox.getDirectory();
    path = directory + fileName;
    fileConfirmation.setText(path);
    if (e.getSource() == saveButton ) {
    try{
    outputFile = new PrintWriter( new FileWriter(fileName, true), true);
    outputFile.print(inputTextArea.getText() );
    outputFile.close();
    catch (FileNotFoundException e1) {
    return;
    catch (NullPointerException e2) {
    return;
    catch (IOException e3) {     
    JOptionPane.showMessageDialog(null,
    "There was an error in opening this file!");
    System.exit(0);
    }

    'you can use "append()" method...
    ex.
    // some code here...
         inputTxtArea.append(data+"\n");  //<<-- you need to put '\n'
    // some code here...

  • Is it possible to read a text file into an applet?

    I have a text file that contains data I want to use in my applet. Is there a way to read in the data?
    Thanks,
    Brad

    With a signed applet you can read a file from the local hard disk. There is a forum for signed applets. The source code of your signed applet will require some additional code (before opening and reading the file, like // create a permission object
    FilePermission perm = new FilePermission("path/file", read);
    // check the permission object
    AccessController.checkPermission(perm);

  • Query Output Into a Text File

    Hello Experts,
    There is a situation where i need ur help.My query is :
    Can I export the output of more than one queries into a * Single Text File * ?
    Also can it be possible to automate these Queries Output to export into the Text File ??
    I also want this Text File Output to mail the end users by using the Process Chain. So is this possible to create a process chain for sending this Text File to the Users via mail ??
    Thanks In Advance
    Neha

    Hello Neha,
    Though i have been working with APDs since some time. But havent actually been involved in designing one. But you could find many documents for the APD on web. And as far as i know, you will need a program to save file from APD.
    I have a document which explains how you can use APD in  process chain. can forward you the same if you want.
    I am sorry as i wasnt of much help for you, as i havent worked on similar requirement before, but this thing just striked in my mind.
    Regards,
    Anuj

  • Output into a text file

    Hi all, i am trying to parse an xml doc from a url and the display the results in an text file, howver when i run the below code the Headers are coming up the the returned results are being displayed int the cmd prompt window, anyone have any ideas on how to display the results in a text file?
    import org.apache.xerces.parsers.DOMParser;
    import org.xml.sax.SAXException;
    import java.io.IOException;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.NamedNodeMap;
    import java.util.Properties;
    import java.io.*;
    public class IsbnSearch{
        public static void main(String args[]) throws IOException, SAXException{
            //Check out: http://www.rgagnon.com/javadetails/java-0085.html
            Properties systemSettings = System.getProperties();
            systemSettings.put("http.proxyHost", "staff-proxy.ul.ie");
            systemSettings.put("http.proxyPort", "8080");
            System.setProperties(systemSettings);
            FileOutputStream out; // declare a file output object
            PrintStream p ; // declare a print stream object
            String isbn;
            String size;
            BufferedReader reader;
            reader = new BufferedReader(new InputStreamReader(System.in));
            System.out.print("Please enter Isbn Number\n");
            try {
                 out = new FileOutputStream("myfile.xls");
                 p = new PrintStream( out );
                 isbn = reader.readLine();
            System.out.print("Please Choose the Level of Detail you require:\n");
            System.out.print("Small, Medium or Large\n");
                    size = reader.readLine();
            DOMParser parser = new DOMParser();
            parser.parse("http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Version=2005-03-23&Operation=ItemLookup&ContentType=text%2Fxml&SubscriptionId=0525E2PQ81DD7ZTWTK82&ItemId="+isbn+"&IdType=ASIN&ResponseGroup="+size+"");
            Document dom = parser.getDocument();
            p.println("\nTitle:");
            getAttribute(dom, "Title");
            p.println("\nAuthor:");
            getAttribute(dom, "Author");
            p.println("\nImage:");
            getAttribute(dom, "SmallImage");
            p.println("\nISBN:");
            getAttribute(dom, "ISBN");
            p.println("\nBinding:");
            getAttribute(dom, "Binding");
            p.println("\nReview:");
            getAttribute(dom, "Content");
            p.println("\nDetail Website Please Visit =:");
            getAttribute(dom, "DetailPageURL");
            p.println("\nTime to process Request:");
            getAttribute(dom, "RequestProcessingTime");
            catch (IOException ioe) {
                 System.out.println("I/0 Exception Occurresd");
        private static void getAttribute(Document dom, String tagName)throws IOException {
                 NodeList ItemAttributes = dom.getElementsByTagName(tagName);
                    for(int i=0;i<ItemAttributes.getLength();i++){
                Node aNode = ItemAttributes.item(i);
                System.out.println(aNode.getFirstChild().getNodeValue());
                NamedNodeMap attributes = aNode.getAttributes();
                for (int a=0;a<attributes.getLength();a++){
                    Node theAttribute = attributes.item(a);
                    System.out.println(theAttribute.getNodeName() + "="+ theAttribute.getNodeValue());
    }

    I suppose you mean that the output of this line of codeSystem.out.println(theAttribute.getNodeName() + "="+ theAttribute.getNodeValue());is coming out on the console? Yup. That's what System.out is for. Let me point you at the Java I/O tutorial:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html
    It explains how to write to a file.

  • How to resend the RMAN output to a text file

    Hi ,
    I am using RMAN for backup purpose.
    How should we send the output of RMAN to a text file.
    For Example If we issue the following command then how should we send the results of that command into a text file:
    RMAN> report obsolete device
    type 'sbt_tape';
    result:
    RMAN-03022: compiling command: report
    RMAN-06147: no obsolete backups found
    Any ideas will be great for me.
    Thanks
    Kumar

    Example:
    [oracle@ozawa oracle]$ sqlplus /nolog
    SQL*Plus: Release 9.2.0.1.0 - Production on Thu Mar 4 09:38:40 2004
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    SQL> spool my_output.txt
    SQL>
    SQL> host rman target /
    Recovery Manager: Release 9.2.0.1.0 - Production
    Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
    connected to target database: LQACNS1 (DBID=1237456636)
    RMAN>
    RMAN>
    RMAN> quit
    Recovery Manager complete.
    SQL>
    SQL> spool off
    SQL>
    SQL> quit
    Joel Pérez

  • How to redirect the tomcat (5.0) console output to a text file

    Hello,
    I am looking for a way of redirecting the tomcat console output [the System.out.println("xyzabc")�s from the java classes running on the container] to a text file.
    The reason is that the programmers need to have that console�s output and the server (windows) have to be rebooted often (no wonder: windows) and then Tomcat start as a service -> console is not visible.
    Thanks!

    The console out put should still be in the log files if tomcat is running as a windows service. It will either be in logs\stdout_xxxx.log and logs\stderr_xxxx.log or in logs\catalina.xxxx.log.
    If you are using 5.5.
    It will either be in logs\stdout.log and logs\stderr.log or in logs\catalina.out.
    if you are using 5.0

Maybe you are looking for

  • Is there a way to disable mouse acceleration in OSX Yosemite?

    i have used my dads iMac and MBP in the past and always noticed how bad the mouse response was in my opinion. Mind you, some people like the way the mouse responds in OSX and will probably have no idea what my issue is. That is mouse acceleration and

  • Using a credit in an itunes account

    When I purchase an app in the store it prompts me to use a credit card instead of using the credit from the itunes card that I loaded into my account.  It will work on two of my ipads but not a third.

  • How to increase the number of scrollable shell/terminal lines?

    Hi guys, I've just run "pacman -Syu" and got hundreds of error lines. When I tried to scroll up to the first one by pressing "shift-pageup" I noticed, that I could only go back a couple of lines. So apparently my terminal "forgot" the first few lines

  • Which cable modems work best with Time Capsule?

    Which cable modems work best with Time Capsule? I have Time Warner in SoCal. I am replacing my old Motorola cable modem (constantly cuts out and needs to be reset) and I also bought a new Time Capsule. I will be using the Time Capsule for my wireless

  • Visual admin login (end of stream error)

    If I logon to visual administrator I am getting the following error during connection time(12%)   Unable to logion to Hostname: End of stream reached unexpectedly during input from socket( 168.15.5.2 ,port =50004,localport =2825) beacuse of this prob