Read System.in from JTextField

hi all, I have found this code that redirect System.in and System.out on JTextArea:
package xyzGui;
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
public class resGui extends javax.swing.JFrame {
    PipedInputStream piOut;
    PipedInputStream piErr;
    PipedOutputStream poOut;
    PipedOutputStream poErr;
    /** Creates new form resGui */
    public resGui() {
        initComponents();
        try {
            // Set up System.out
            piOut = new PipedInputStream();
            poOut = new PipedOutputStream(piOut);
            System.setOut(new PrintStream(poOut, true));
            // Set up System.err
            piErr = new PipedInputStream();
            poErr = new PipedOutputStream(piErr);
            System.setErr(new PrintStream(poErr, true));
            // Create reader threads
            new ReaderThread(piOut).start();
            new ReaderThread(piErr).start();
        catch(Exception e) {
            System.exit(0);
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        consoleArea = new javax.swing.JTextArea();
        commandLine = new javax.swing.JTextField();
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
        jScrollPane1.setViewportView(consoleArea);
        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 60, 610, 200));
        commandLine.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                commandLineKeyPressed(evt);
        getContentPane().add(commandLine, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 610, -1));
        pack();
    private void commandLineKeyPressed(java.awt.event.KeyEvent evt) {
        if(evt.getKeyCode()==10) {
            String val = commandLine.getText();
            if(val.equals("exit")) {
                System.exit(0);
            commandLine.setText("");
            consoleArea.append(val+"\n");
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
        System.exit(0);
    // Variables declaration - do not modify
    private javax.swing.JTextField commandLine;
    private javax.swing.JTextArea consoleArea;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration
    class ReaderThread extends Thread
        PipedInputStream pi;
        ReaderThread(PipedInputStream pi)
            this.pi = pi;
        public void run()
            final byte[] buf = new byte[1024];
            try
                while (true)
                    final int len = pi.read(buf);
                    if (len == -1)
                        break;
                    SwingUtilities.invokeLater(new Runnable()
                        public void run()
                            consoleArea.append(new String(buf, 0, len));                           
                            // Make sure the last line is always visible
                            consoleArea.setCaretPosition(consoleArea.getDocument().getLength());
            catch (IOException e)
}...I would like, if possible read System.in from JTextField and not from JTextArea:
Input from text box and output to text area.
Thanks

It doesen't work. I would like to create a GUI for a command line application. I would like to send command to my "command line" application using textfield in GUI and not using console. In my sample System.out is redirected on JTextArea I try to redirect JTextFiled value on System.in...

Similar Messages

  • Reading System Spec from an Applet

    Hi guys.
    Can some applet expert tell me what System spec is available to a signed applet to read?
    I'm after stuff like amount of physical memory, free HDD space, cpur speed, gfx card etc - the type of stuff you get from DXDiag. I know the majority of it is not available. I was just wondering what was.
    Thanks.

    Yes, it's possible. Use this:
            Runtime r = Runtime.getRuntime ();
            Process p = r.exec ( command );++ read the help and use http://www.google.com for more informations.

  • Read System Information from the Client

    Hi,
    i am looking for a java native interface that allows me to read the client's system information like it can be done with the sigar lib.
    http://support.hyperic.com/confluence/display/SIGAR/Home
    Does anyone know if there are alternative native libraries available?!
    Thanks in advance,
    Patrick

    I'm doing exactly the same in both projects.The OS loads the library into the process space.
    You know it works in java. Thus it means specifically that it is an environment problem. It is not a java problem and it is not a library problem.
    The problem is that the library fails to load.
    General reasons for loading failures. There might be others.
    - It isn't a library. Can't be this because you got it to work already.
    - It has dependencies, other libraries, that don't exist or are not in the shared library path.
    - It isn't in fact the same as the other webstart app. Different location, different coniguration, permissions problem, something else.

  • Reading values from JTextField and using them?

    Hello,
    I am trying to make a login screen to connect to an oracle database. Im pretty new to creaing GUI. I need help with reading the values from the JTextField and to be able to use them for my connection. So do I need to apply a listener? How do I go about doing that in this project. Thanks for any code or advice.
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.sql.*;
    public class UserDialog
        String databaseURL;
        String driver;
        String database;
        String username;
        String password;
        String hostname;
        String port;
        UserDialog() {
            getInfo();
        static String[] ConnectOptionNames = { "Login", "Cancel" };
        static String   ConnectTitle = "Login screen";
        public void getInfo() {
            JPanel      connectionPanel;
            JLabel     databaseURLLabel = new JLabel("Database URL:   ", JLabel.LEFT);
         JTextField databaseURLField = new JTextField("");
         JLabel     driverLabel = new JLabel("Driver:   ", JLabel.LEFT);
         JTextField driverField = new JTextField("");
            JLabel     databaseLabel = new JLabel("Database:   ", JLabel.LEFT);
         JTextField databaseField = new JTextField("");
            JLabel     usernameLabel = new JLabel("User Name:   ", JLabel.LEFT);
         JTextField usernameField = new JTextField("");
            JLabel     passwordLabel = new JLabel("Password:   ", JLabel.LEFT);
         JTextField passwordField = new JPasswordField("");
            JLabel     hostnameLabel = new JLabel("Host Name:   ", JLabel.LEFT);
         JTextField hostnameField = new JTextField("");
            JLabel     portLabel = new JLabel("Port:   ", JLabel.LEFT);
         JTextField portField = new JTextField("");
         connectionPanel = new JPanel(false);
         connectionPanel.setLayout(new BoxLayout(connectionPanel,
                                  BoxLayout.X_AXIS));
         JPanel namePanel = new JPanel(false);
         namePanel.setLayout(new GridLayout(0, 1));
         namePanel.add(databaseURLLabel);
         namePanel.add(driverLabel);
            namePanel.add(databaseLabel);
            namePanel.add(usernameLabel);
            namePanel.add(passwordLabel);
            namePanel.add(hostnameLabel);
            namePanel.add(portLabel);
         JPanel fieldPanel = new JPanel(false);
         fieldPanel.setLayout(new GridLayout(0, 1));
         fieldPanel.add(databaseURLField);
            fieldPanel.add(driverField);
            fieldPanel.add(databaseField);
            fieldPanel.add(usernameField);
         fieldPanel.add(passwordField);
            fieldPanel.add(hostnameField);
            fieldPanel.add(portField);
         connectionPanel.add(namePanel);
         connectionPanel.add(fieldPanel);
            // Connect or quit
            databaseURL = databaseURLField.getText();
            driver = driverField.getText();
            database = databaseField.getText();
            username = usernameField.getText();
            password = passwordField.getText();
            hostname = hostnameField.getText();
            port = portField.getText();
            int n = JOptionPane.showOptionDialog(null, connectionPanel,
                                            ConnectTitle,
                                            JOptionPane.OK_CANCEL_OPTION,
                                            JOptionPane.PLAIN_MESSAGE,
                                            null, ConnectOptionNames,
                                            ConnectOptionNames[0]);
            if (n == 0) {
                System.out.println("Attempting login: " + username);
                String url = databaseURL+hostname+":"+port+":"+database;
             // load the JDBC driver for Oracle
             try{
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   Connection con =  DriverManager.getConnection (url, username, password);
                System.out.println("Congratulations! You are connected successfully.");
                con.close();
                System.out.println("Connection is closed successfully.");
             catch(SQLException e){
                System.out.println("Error: "+e);
            else if (n == 1)
                    System.exit(0);
        public static void main (String args []) {
             UserDialog ud = new UserDialog();
    }thanks again,
    James

    the reason why you can't get the text is because you are reading the value before some actually inserts anything in any fields.
    Here is what you need to do:
    Create a JDialog/JFrame. Create a JPanel and set that panel as contentPane (dialog.setContentPane(panel)). Insert all the components, ie JLabels and JTextFields. Add two buttons, Login and Cancel to the panel as well. Now get the username and password field values using getText() inside the ActionListener of the Login.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class LoginDialog extends JDialog
    String username, password;
      public LoginDialog( ){
        setTitle( "Login" );
        JPanel content = new JPanel(new GridLayout(0, 2) ); // as many rows, but only 2 columns.
        content.add( new JLabel( "User Name" ) );
        final JTextField nameField = new JTextField( "" );
        content.add( nameField );
        content.add( new JLabel( "Password" ) );
        final JTextField passField = new JTextField( "" );
        content.add( passField );
        JButton login = new JButton( "Login" );
        login.addActionListener( new ActionListener(){
          public void actionPerformed( ActionEvent ae ){
            username = nameField.getText();
            password = passField.getText();
            // call a method or write the code to verify the username and login here...
        content.add( login );
        JButton cancel = new JButton( "Cancel" );
        cancel.addActionListener( new ActionListener( ){
          public void actionPerformed( ActionEvent ae ){
            dispose(); // close the window or write any code that you want here.
        content.add( cancel );
        pack( ); // pack everything in the dialog for display.
        show(); // show the dialog.

  • How to read some images from file system with webdynpro for abap?

    Hi,experts,
    I want to finish webdynpro for abap program to read some photos from file system. I may make MIMES in the webdynpro component and create photos in the MIMES, but my boss doesn't agree with me using this way. He wish me read these photos from file system.
    How to read some images from file system with webdynpro for abap?
    Thanks a lot!

    Hello Tao,
    The parameter
       icm/HTTP/file_access_<xx>
    may help you to access the pictures without any db-access.
    The following two links may help you to understand the other possibilities as well.
    The threads are covering BSP, but it should be useful for WebDynpro as well.
    /people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    http://help.sap.com/saphelp_sm40/helpdata/de/c4/87153a1a5b4c2de10000000a114084/content.htm
    Best regards
    Christian

  • Can I use LabVIEW to load data directly into system memory? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Win32 function to read the data from the card and now I want it to go directly to system memory.

    Can I use LabVIEW to load data directly into system memory from a VI? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Call Library function to read the data from the card and now I want it to go directly to system memory.
    The data is being received at 1Mbps.
    Thanks

    Two questions:
    One, if it's a serial card, then presumably it gives you more serial ports, like COM3, COM4, etc. If so, VISA would see the COM ports, and not the card directly. The drivers for the card should make it so that you see the extra serial ports from the OS. If you don't see the extra COM ports from VISA, then it sounds like the drivers for the card are not installed properly. Do the extra COM ports show up in Device Manager?
    Two, you said that you're using a Call Library function to get the data and you want to put it into system memory. Errr.... you just read the data and you have it in memory by definition. Are you saying you need a way to parse the data so it shows up on a graph or something?

  • How to read multiple documents from a system directory?

    Hi,
    I'm trying to read multiple documents from a specific folder that contains pdfs, jpgs... the only activity I found is the Read Document, but this activity does not have the option to read all docs under my folder!.
    so any one can tell me if there is another activity can do it or is there any good solution to loop on the folder and read all the docs? any script will be helpful.
    Thanks
    Hussam

    Hi,
    After many hours of searching and readings, I found a solution, I do not know if it is the best, but  anyhow this is my solution:
    By using a service operation called "Find" from a service named "FileUtilsService", this operation will return a list of strings with the names of all files and/or directories under the path you want.
    Then by using the "Read Document"  I was able to get one file and store it in a dcoumnet variable, and by using a simple looping technique I got all  the files I want.
    hope this will help others
    Hussam

  • GUI problem with textfields, reading in text from a textpad

    Alright well, here is my problem. I am having trouble with aliging the textfields to how I want it but I can't get it to come out how I want it. First, I am trying to figure out how to have the some text appear right above a textfield. Example:
    File Name
    I can't get it appear that way, the text appears side to side with the textfield. And the other problem is how can I made the size of textfield to how I want it. I was reading that you have to assign a specfic number in the text field.
    This is the code I have so far:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class IP_Header extends JApplet
    private JTextField lookUp, showInfo;
    private JButton analyze;
    private JLabel msg;
    public void init()
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(3,2));
    p1.add(new JLabel("File Name"));
    p1.add(lookUp = new JTextField());
    p1.add(analyze = new JButton("Analyze"));
    p1.add(showInfo = new JTextField());
    msg = new JLabel(" ");
    Container cp = getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(p1, BorderLayout.NORTH);
    With this what I am tryin to do is as follows:
    File Name
    * "TextField" * *
    **************** * This is a textfield where I am just going to
    * have some text appear in it
    * "Button" * *
    Thank you for your help. I hope you can help me. I haven't done java for a quite a while. Thanks again

    Thanks for help ... really helpful and understanding. I am trying to read a file from the computer which has some numbers in it and I want those numbers to be shown on the textfields individually. The numbers are in a notepad file and they are .... 4, 5, 200, 780, 1, 0, 0, 12, 6, 0, 129, 24, 21, 44, 133, 62, 159, 7. I got the program to compile and everything by adding the code that I believe should work . But whenever I put the file name in and press the button analyze ... it gives me a error saying "Exception: access denied (java.io.FilePermission c:\TCP read) .. can't quite get it ...here the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    public class IP_Header extends JApplet
        private JTextField lookUp, showInfo;
        private JButton analyze;
        private JLabel msg;
        public void init()
            GridBagLayout gridbag = new GridBagLayout();
            JPanel p1 = new JPanel(gridbag);
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.gridwidth = gbc.REMAINDER;     // one component per row
            gbc.insets = new Insets(0,20,5,0); // spacer [top, left, bottom, right]
            gbc.weightx = 1.0;                 // allows horizontal placement
            gbc.anchor = gbc.WEST;             // align left
            p1.add(new JLabel("File Name"), gbc);
            p1.add(lookUp = new JTextField(16), gbc);
            p1.add(analyze = new JButton("Analyze"), gbc);
            p1.add(showInfo = new JTextField(16), gbc);
            // center section of content pane border layout
            // First Panel - 2 rows, 4 columns
            JPanel p2 = new JPanel(gridbag);
            gbc.insets = new Insets(2,0,0,0);
            gbc.anchor = gbc.CENTER;
            JTextField verText = new JTextField(8);
            JTextField HLENText = new JTextField(8);
            JTextField ServiceType = new JTextField(8);
            JTextField TotalText = new JTextField(8);
            gbc.gridwidth = 1;
            p2.add(new JLabel("VER"), gbc);
            p2.add(new JLabel("HLEN"), gbc);
            p2.add(new JLabel("Service Type"), gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p2.add(new JLabel("Total Length"), gbc);
            gbc.gridwidth = 1;
            p2.add(verText, gbc);
            p2.add(HLENText, gbc);
            p2.add(ServiceType, gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p2.add(TotalText, gbc);
            // Second Panel - 4 rows, 3 columns
            JPanel p3 = new JPanel(gridbag);
            JTextField fragText = new JTextField(8);
            JTextField flags = new JTextField(8);
            JTextField fragOffText = new JTextField(8);
            gbc.insets = new Insets(5,0,0,0);
            gbc.gridwidth = 1;
            p3.add(new JLabel("Fragmentation ID"), gbc);
            p3.add(new JLabel("Flags"), gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p3.add(new JLabel("Fragmentation Offset"), gbc);
            gbc.insets = new Insets(2,0,0,0);
            gbc.gridwidth = 1;
            p3.add(fragText, gbc);
            p3.add(flags, gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p3.add(fragOffText, gbc);
            JTextField ttlText = new JTextField(8);
            JTextField protocolText = new JTextField(8);
            JTextField headText = new JTextField(8);
            gbc.insets = new Insets(5,0,0,0);
            gbc.gridwidth = 1;
            p3.add(new JLabel("TTL"), gbc);
            p3.add(new JLabel("Protocol"), gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p3.add(new JLabel("HeaderChecksum"), gbc);
            gbc.insets = new Insets(2,0,0,0);
            gbc.gridwidth = 1;
            p3.add(ttlText, gbc);
            p3.add(protocolText, gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p3.add(headText, gbc);
            // Third Panel - 4 rows, 4 columns
            JPanel p4 = new JPanel(gridbag);
            JTextField sIP1text = new JTextField(4);
            JTextField sIP2text = new JTextField(4);
            JTextField sIP3text = new JTextField(4);
            JTextField sIP4text = new JTextField(4);
            gbc.insets = new Insets(5,0,0,0);
            gbc.gridwidth = 1;
            p4.add(new JLabel("SourceIP"), gbc);
            p4.add(new JLabel(" "), gbc);
            p4.add(new JLabel(" "), gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p4.add(new JLabel(" "), gbc);
            gbc.insets = new Insets(2,0,0,0);
            gbc.gridwidth = 1;
            p4.add(sIP1text, gbc);
            p4.add(sIP2text, gbc);
            p4.add(sIP3text, gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p4.add(sIP4text, gbc);
            JTextField dIP1text = new JTextField(4);
            JTextField dIP2text = new JTextField(4);
            JTextField dIP3text = new JTextField(4);
            JTextField dIP4text = new JTextField(4);
            gbc.insets = new Insets(5,0,0,0);
            gbc.gridwidth = 1;
            p4.add(new JLabel("Destination IP"), gbc);
            p4.add(new JLabel(" "), gbc);
            p4.add(new JLabel(" "), gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p4.add(new JLabel(" "), gbc);
            gbc.insets = new Insets(2,0,0,0);
            gbc.gridwidth = 1;
            p4.add(dIP1text, gbc);
            p4.add(dIP2text, gbc);
            p4.add(dIP3text, gbc);
            gbc.gridwidth = gbc.REMAINDER;
            p4.add(dIP4text, gbc);
            JPanel panel = new JPanel(gridbag);
            gbc.fill = gbc.HORIZONTAL;
            gbc.insets = new Insets(0,5,0,5);
            panel.add(p2, gbc);
            panel.add(p3, gbc);
            panel.add(p4, gbc);
            msg = new JLabel(" ");
            Container cp = getContentPane();
            cp.setLayout(new BorderLayout());
            cp.add(p1, "North");
            cp.add(panel);
            setSize(450,375);
             analyze.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        String array[] = new String[18];
                        String blankString = new String();
                        String tempString = lookUp.getText();
                        showInfo.setText(array[0]);
                        try
                             FileReader fr = new FileReader(tempString);
                             BufferedReader br = new BufferedReader(fr);
                             String line = br.readLine();
                             StringTokenizer st = new StringTokenizer (line,",");
                             for (int i=0; i<=18; i++)
                                  array[i] = st.nextToken().trim();
                        catch(Exception f)
                             System.out.println("Exception: " + f.getMessage());
    }

  • How can i get the System Time from the other host

    I want to get the System Time from the other host in the LAN,How can I get the Time using Java.
    Such as I am in WIN 2000 and I have a Unix host in LAN, I want to get unix host System time, How can I do it.

    Open a socket to port 13 and read a string with the time.
    -or-
    Open a socket to port 27 and read 4 bytes that are a network order timestamp
    Assuming that your UNIX machine has those services running, most do

  • How to delete a READ ONLY file from Directory

    Hi Friends,
    how to delete a READ ONLY file from Directory , file is in my system only.
    Please help me .
    note: its read only file.
    Thank you.
    Karthik.

    hI,
    try with this statement.
    delete dataset <datasetname>.
    this will definitely work.
    Regards,
    Nagaraj

  • How to read the file from ftp server

    Hi
    I need to read a file from a ftp server . Iam using apache lib common-net .jar .
    FTPClient ftp = new FTPClient();
    ftp.connect(server);
    ftp.login(username,password);
    FTPFile[] files = ftp.listFiles();
    for(int i=0 ;i<files.length;i++){
    System.out.println(" File : "+ i + " - " + files);     
    InputStream ip = ftp.retrieveFileStream(path);
    I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
    help me plzzzzz

    Hi
    I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
    InputStream ip = ftp.retrieveFileStream(path);                    
    File f = new File("D:\\ftp.txt");                    
    FileOutputStream fo = new FileOutputStream(f);
    byte[] buf = new byte[1024];
    while ((len = ip.read(buf)) > 0) {                         
    fo.write(buf,0,len);               
    fo.close();
    BufferedReader br = new BufferedReader(new InputStreamReader(ip));
    String line;
    do {
    line = br.readLine();
    System.out.println(" data " +line);
    }while (line != null);

  • Reading one line from a text file into an array

    i want to read one line from a text file into an array, and then the next line into a different array. both arays are type string...i have this:
    public static void readAndProcessData(FileInputStream stream){
         InputStreamReader iStrReader = new InputStreamReader (stream);
         BufferedReader reader = new BufferedReader (iStrReader);
         String line = "";          
         try{
         int i = 0;
              while (line != null){                 
                   names[i] = reader.readLine();
                   score[i] = reader.readLine();
                   line = reader.readLine();
                   i++;                
              }catch (IOException e){
              System.out.println("Error in file access");
    this section calls it:
    try{                         
         FileInputStream stream = new FileInputStream("ISU.txt");
              HighScore.readAndProcessData(stream);
              stream.close();
              names = HighScore.getNames();
              scores = HighScore.getScores();
         }catch(IOException e){
              System.out.println("Error in accessing file." + e.toString());
    it gives me an array index out of bounds error

    oh wait I see it when I looked at the original quote.
    They array you made called names or the other one is prob too small for the amount of names that you have in the file. Hence as I increases it eventually goes out of bounds of the array so you should probably resize the array if that happens.

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • I may have deleted some system files from my computer due to my antivirus and now my imac won't start. Actually it does, and then there is a blank screeen with the apple logo and it shuts down right away. is tehre a possibility of recovering my files?

    Hello
    I was having some problems with my Imac, for a while it was slow and often disconneceted from my wifi, while this one worked perfectly (tested with other devices)
    I thoug i might have a virus, so i downloaded an antivirus (mac keeper) and started checking.
    I also did a scan of my computer using Console or something from the utilities, and then a folder popped witha  file I had canceled a while ago. I canceled the file and then my Imac continued to be slow.
    i then restarted my Imac, but when it started, the usual grey logo of Apple appeared, and then it shut down suddently.
    I tried to reboot it holding the command key and R but nothing, and then i tried holding the shift key and a bar appeared, and at half of the bar it sut itself down again.
    I think it is probably a preoblem because I may have cancelled some of the system files from a folder called "private" in the "documents" folder.
    Is there any way I can recover some of my files? maybe all of them? I hope so because I have some important files there
    Is this a thing I can do myself or do Ineed to go to a MacStore to repair it? Will I need to change HD or just to format it and reinstall? also if there is any way i can recover some of my files that would be great.
    Thanks
    Ludo
    P.S. problems appeared when i installed the Mavericks version.

    If MacKeeper corrupted the Recovery partition then even I underestimated its potential for damage. Garbage "cleaning" apps will cause misery but I have not found that the Recovery partition to have been affected by using MacKeeper or anything like it. I doubt that it did so, but I have learned not to underestimate the potential for such things to result in system corruption.
    Before concluding your Mac has a hardware failure, try booting OS X Internet Recovery by holding command option r on startup (three fingers). That will force your iMac to bypass the Recovery partition altogether, and convey the ability to create a new one.
    An Internet connection will be required (wired or wireless).
    At the Mac OS X Utilities screen, select Disk Utility. Select your startup volume (usually named "Macintosh HD") and click the Repair Disk button. Describe any errors it reports in red. If Disk Utility reports "The volume Macintosh HD appears to be OK" in green then you can be reasonably (though not completely) assured your hard disk is in good working order.
    Assuming the HD remains usable you can then use Disk Utility to erase it. Reinstall OS X, restore your essential software and other files, and don't reinstall the junk.

  • Mozilla apps won't load after System Restore from TM

    Alas, a hard disk failure which Apple kindly replaced even though It happened 25 days out of 3-year AppleCare. Thanks!
    New hard disk installed, proceeded to do System restore from TimeMachine and everything went perfectly (as far as I can tell) EXCEPT Firefox and Thunderbird. All the other apps are loading and seem to be working as I would expect (I guess I won't know for sure until I've worked for a few days) but Firefox will not load - the icon bounces in the dock for a couple of seconds and then disappears. Out of curiosity, I tired to load Thunderbird (which I seldom use) and not even the icon appears.
    I am using OS-X 10.5.7 with Firefox 3.0.11
    I have tried deleting the apps and the associated files in Library?Application Support and doing a re-install from a fresh download - same result. I tired restoring the apps from TimeMachine using a restore date one day before the HardDisk failure. Same result. I have used MacTuneUp to repair permission. Same result.
    Any ideas why this is happening? I am most surprised that a fresh install didn't help. And it's interesting that two Mozilla apps are affected. I can live without Thunderbird but Firefox is important as there are some websites that still refuse to open with Safari.

    [email protected] wrote:
    OK - that was a good suggestion. Firefox and Thunderbird both work when I log is as a guest. Now what should I be looking for on my main account that is blocking the apps from opening? Thanks for the help.
    probably something in their preferences. the most radical thing would be to delete the whole folders /users/usernmae/library/application support/firefox and /users/username/library/thunderbird. or just move those folders to the desktop. then try starting firefox and thunderbird. however, that will wipe all user info in both apps.

Maybe you are looking for

  • Delete flv from server

    How do I delete an flv file from a media server? I have an application in which registered users can store flv files. When a user is removed from the system, I want to remove their name from a database and all of their videos from the server. I've ta

  • Lightroom Crash on Import with CS3 installed

    The last two days, I have been importing fairly large shoots from CF cards with Lightroom (Yesterday 147, today 79). In both cases I have received the Adobe Photoshop Lightroom has encountered a problem and needs to close.." message; twice today. I i

  • Is there a way to either run a "Score" thing in Keynote, or a text box that can be typed in during the presentation?

    Is there a way to either run a "Score" thing in Keynote, or a text box that can be typed in during the presentation?

  • Region Source - Dynamic Where Clause

    I cannot find anyway to call a function to dynamically generate a where clause for a SQL Query for the region source. For a given set of html text input types. The where clause builds is build based on the populated values of the textfields, if they

  • Working with wf_bpel_Q

    I have raised a business event in oracle workflow administrator. But I couldn't see the event going into wf_bpel_qtab. Any logs I can look into to check if the event is really getting raised?