File IO basics more than 1 problem with streams any help?

Have console program that i've built up in steps from reading args from the command line and displaying the text to now wanting to learn to read and write to a disk file.
i know i have a number of errors but believe it's down to something i am not understanding with the use of datastreams.
a snippit of code is below.
  if (args.length > 0)
            // Read what the use has entered and keep for later use
        for (int i=0; i < args.length; i++)
          text = text + args;
try
//path is define further up as c:\my projects\
System.out.print (path);
//create a file object to point to the file the user has given for reading to
// the file and another to read the file back in
File fileIn = new File (path,text);
// File fileOut = new File (path,text);
// Not sure if this is required!!
fileIn.createNewFile();
// thefileOut.createNewFile();
//Thought this would be the right way of of creating the stream
// DataOutputStream thefileIn = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileIn)));
// DataOutputStream thefileOut = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileOut)));
//errors on exists and delete methods
if (fileIn.exists())
fileIn.Delete();
catch(IOException e)
{            // also errors in the getmessage
System.out.print("Error occured!"+ fileIn.getmessage());
the errors i am getting are to do with the DELETE method
The Getmessage method
Exits method
i have others but if i can get help with these then i might be able to fix the others.
thanks

complete program code below :)
import java.io.*;
public class mysimpleio
  String thefilename = "";
//  String ToFile(String thefilename);
//  String FromFile(String thefilename);
  public static void main(String[] args)
    String text = "";
    String path = "e:\\my_project\\crm\\";
    if (args.length == 0)
        System.out.println("No file name, Exiting program!");
    if (args.length > 0)
        for (int i=0; i < args.length; i++)
          text = text + args;
try
System.out.print (path);
File fileIn = new File (path,text);
// File fileOut = new File (path,text);
fileIn.createNewFile();
// thefileOut.createNewFile();
// DataOutputStream thefileIn = new DataOutputStream(new
BufferedOutputStream(new FileOutputStream(fileIn)));
// DataOutputStream thefileOut = new DataOutputStream(new
BufferedOutputStream(new FileOutputStream(fileOut)));
if (fileIn.exists())
fileIn.delete();
catch(IOException e)
System.out.print("Error occured!"+ fileIn.getmessage());
ToFile(text);
System.out.print("\n okay so you entered "+ text);
if (!fileIn.exists())
System.out.println("Sorry no file found matching " + text);
else
if (fileIn.exists())
FromFile(text);
// put data to a Disk File
static void ToFile(String thefilename)
// thefileOut.writeUTF(path);
System.out.println("Data would be written to file Now! "
+thefilename);
//Read data From a Disk File
static void FromFile(String thefilename)
fileIn.readUTF(path);
System.out.println(" Data would be Read From file Now! "
+thefilename);
Errors are....
can not resolve symbol
E:\my_project\crm>javac mysimpleio.java
mysimpleio.java:43: cannot resolve symbol
symbol : variable fileIn
location: class mysimpleio
System.out.print("Error occured!"+ fileIn.getmessage());
^
mysimpleio.java:49: cannot resolve symbol
symbol : variable fileIn
location: class mysimpleio
if (!fileIn.exists())
^
mysimpleio.java:53: cannot resolve symbol
symbol : variable fileIn
location: class mysimpleio
if (fileIn.exists())
^
mysimpleio.java:70: cannot resolve symbol
symbol : variable path
location: class mysimpleio
fileIn.readUTF(path);
^
mysimpleio.java:70: cannot resolve symbol
symbol : variable fileIn
location: class mysimpleio
fileIn.readUTF(path);
^
5 errors
E:\my_project\crm>

Similar Messages

  • More than one problem with messages app

    I'm trying to get this Messages app to work properly on my iphone and macbook pro.  I have a few problems that are just very annoying and I can't seem to figure out what I am doing wrong.  I'm sure it is some stupid setting I am overlooking, but I have exhausted my brain for the day. 
    1st problem - I can send and recieve messages on my mac and iphone.  That works fine, but there are no notifications on my mac when I send a message from my iphone.  The message shows up in the app, but it doesn't give me a notification or a badge that there are new messages.  I have it turned on in the settings, but it just won't work...
    2nd problem - My phone is the only one that is working.  My whife has been sending me imessages from the other room for the past hour testing out the app and I get the messages on my phone, but none are showing up on my mac.  I thought they were supposed to go to both?
    I really hope someone can help me here.  I am very frustrated with the whole thing. 

    HI,
    On the iPhone in Settings > Messages > Received At > Caller ID there should be two "IDs"
    One is the iPhone's own number and the other should be the Apple ID.
    If the Apple ID is ticked then iMessages sent from the Phone should sync to the Messages app.
    However incoming iMessages to the iPhone via it's Number will not sync to the Messages app.
    This is apparently coming with the iOS 6 release.
    For the Messages App check System Preferences > Notification and the app name and check if it supposed to be using the Dock badge, make sound or display Notifications (Alerts or Banners)
    10:11 PM      Friday; August 10, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • I have more than one problem with my new ThinkPad Twist

    I posted a little over a week ago about the LED indicator on the back of the lid no longer working. Lenovo Customer Service sent me a box in the mail, but I need to find some time off for me to send it in.
    I discovered earlier this afternoon that when I turn the computer screen around and fold it back, the sensor that detects when it is folded back no longer registers this signal to the computer for it to activate autorotate mode. This seems like it's more likely to be a software issue, but I don't have the knowledge to really troubleshoot, so after rebooting and checking for Lenovo updates, I thought I would see if it would resolve itself after a few days.
    Then I found that the volume rocker below the screen doesn't work. But it gets better than that: you can turn the volume up perfectly, but you can't turn it down. Everything about the buttons feels and sounds normal, but it simply doesn't receive that signal. I just don't get it.
    I've had this computer for only a month and a half. I had heard that ThinkPads were pretty decent computers, but for owning it after 4-6 weeks of light-medium duty and having the nifty LED indicator to go out, the automatic auto-rotate trigger to mysteriously stop working, and for this volume button to stop........this looks like a mediocre product to me.
    I've determined that the dysfunctional LED is, in fact, definitively a hardware issue. Is there some way to check on the other two?

    One thought that comes to mind is that XP by default, I think, has the settings for the USB ports to power down when not in use. By "in use" they mean data being transferred, not charging something.
    So first thing to try is go into your control panels, system, hardware, device manager, then open the USB section. Highlight and then right click and each and every USB Root Hub listing you see. Pick properties and go to the Power management tab. Uncheck the box the turns off the USB port power when not in use.
    Now plug you iPod in and see if it charges properly now. If it is very low in power it may not turn on at all for a while (minutes to a half hour) while it trickle charges up to a safe level before powering up again.
    Patrick

  • More than one problem with my fifth generation iopd

    i just got my ipod 2 days ago. yesteday i was putting music and videos on it with no probleams.the batery died completley yesterday.when i went to charge it today, my laptop did not recognize it on my computer or itunes.but on the ipod it said please wait, battery very low and it seemed like it was charging.a few seconds later, the "sad" icon apeared and underneath it it says www.apple.com/support/ipod and then it would go back to saying please wait, battery very low.and the same thing will repeat. i have also tried restarting my ipod, but that wont work.
    i am running windows XP home on my laptop.
    if anyone knows whats wrong with my ipod, please answer my question.
    thnx.

    One thought that comes to mind is that XP by default, I think, has the settings for the USB ports to power down when not in use. By "in use" they mean data being transferred, not charging something.
    So first thing to try is go into your control panels, system, hardware, device manager, then open the USB section. Highlight and then right click and each and every USB Root Hub listing you see. Pick properties and go to the Power management tab. Uncheck the box the turns off the USB port power when not in use.
    Now plug you iPod in and see if it charges properly now. If it is very low in power it may not turn on at all for a while (minutes to a half hour) while it trickle charges up to a safe level before powering up again.
    Patrick

  • Problem with Infinity - Any help / advice apprecia...

    Hi all,
    Have had Infinity for around a month now and it was absolutely mega until about a week ago when it completely stopped working and the DSL light began flashing on the Openreach Modem.  I called support and they arranged for an engineer to call two days later.  After testing my installation he decided that the Openreach Modem was faulty and so replaced it like for like. 
    My problem is that before it broke I was averaging 37 Mbps and since it was repaired the best that I have been able to get is 27 Mbps, a drop of 10 Mbps.  Why has this happened and is there anything I can do to restore my original speed?  Any advice or help offered will be greatly appreciated!
    Thanks.

    Hi all,
    Have had Infinity for around a month now and it was absolutely mega until about a week ago when it completely stopped working and the DSL light began flashing on the Openreach Modem.  I called support and they arranged for an engineer to call two days later.  After testing my installation he decided that the Openreach Modem was faulty and so replaced it like for like. 
    My problem is that before it broke I was averaging 37 Mbps and since it was repaired the best that I have been able to get is 27 Mbps, a drop of 10 Mbps.  Why has this happened and is there anything I can do to restore my original speed?  Any advice or help offered will be greatly appreciated!
    Thanks.

  • WebLogic Error : Registered more than one instance with the same objectName

    HI there, I'm facing a big problem. I have two environments installed on the same physical machine.
    I have ALSB and WLI servers running out there.
    Environment 1 - WLI port running at 7011 domain name : stp_wli_domain and ALSB port running at 8011 domain name: stp_alsb_homo1 - folders- stp_wli_domain / stp_bea_alsb_homo
    Environmnet 2 - WLI port running at 7211 domain name : stp_wli_domain2 and ALSB port tunning at 8211 domain name : stp-alsb_homo2 - folders - stp_wli_domain2 / stp_bea-alsb_homo2
    Everything was working fine, but these days I had install new deployments on both environment and I got this error :
    java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : stp_wli_domain:ServerRuntime=wli_wls01,Name=stp_wli_domain,Location=wli_wls01,Type=AIRuntime new:com.bea.wlai.management.AIRuntimeMBeanImpl@bcf22dc existing com.bea.wlai.management.AIRuntimeMBeanImpl@de02e6c
    The weird is : There is no same object name, as you can see, domains are different, folders are different and ports are diferrent, including multicast addresses.
    Have you guys seen this before ?
    I'm under pressure here, 'cause some projects had stopped to work.
    Please I would appreciate any help.
    Tks.
    Edson

    HI there, thanks for attention..
    See ...
    There's a lot of confusion with these env's .
    I did not built this, so... I'm cleaning my hands.... anyway... :)
    I must fix....
    Well basically if we have two env's, so we have different project each one right ?
    Ok, but I was told that if you have on the same network and same physical machine the name of AdminServer as "AdminServer" in all domains, so it goes with problems... I never heard about it... but is a good practice you put the names for example :
    WLI - WLIAdminServer
    ALSB - AlsbAdminServer
    WLI2 - WLiadminServer2
    ALSB2 - ALsbAdminServer2
    I would do it.. this way..
    But how it wasn't me...
    We got..
    WLI - WliAdminServer
    ALsb - AdminServer
    WLI2 - AdminServer
    ALsb2 - AdminServer
    Have you got it ?
    So... I was told that this could be a problem, almost all AdminServers with the same name... guess what ?Some Projects are back to work. but not at all.. only some.. so I 'm breathing better now... but I would like to know if you seen this before ?
    I would appreciate your help again.
    Unfortunately there's no detailed stack trace to track this
    Tks.

  • Tables with more than one cell with a high number of rowspan (ej. 619). This cell can not be print in a page and it must be cut. But I don't know how  indesign can do this action.

    Tables with more than one cell with a high number of rowspan (ej. 619). This cell can not be print in a page and it must be cut. But I don’t know how  indesign can do this action.

    set the wake-on lan on the main computer
    The laptop's too far away from the router to be connected by ethernet. It's all wifi.
    No separate server app on the laptop, it's all samba
    The files are on a windows laptop and a hard drive hooked up to the windows laptop. The windows share server is pants, so I'd need some sort of third party server running. Maybe you weren't suggesting to use Samba to connect to the windows share though?
    I'm glad that you've all understood my ramblings and taken and interest, thanks The way I see it, I can't be the only netbook user these days looking for this kind of convenience, and I certainly won't be once chrome and moblin hit the market.
    Last edited by saft (2010-03-18 20:38:08)

  • When I open more than one tab with ikls.ru web site - safari freeze immediately.

    I have a Lion OS and all updates. When I open more than one tab with ikls.ru web site - safari are freezing immediately.

    In safe mode the same problem in Safari. And I couldn't enable the guest account. You can see an attached pic. It's in Russian, but I think it's clear. I took a pic in a safe mode, but in normal mode it's the same.

  • How to read a tiff file that has more than one page?

    Hi,
    I use JAI to read TIFF image and get the pixels from a raster object. A TIFF file can have more than one image in itself. The JAI doc from SUN only mentioned that we can get the number of IFD (image file directory) by using
    getNumDirectories() function but no description about how to get different images separately out of one TIFF file. Does any one know how to do it or some example programs implementing such function? Thanks a lot.
    Marvin

    I'm not sure if this helps, but here's a web page which talks about Image I/O:
    http://java.sun.com/products/java-media/jai/iio.html
    For your problem, they have a sample solution which can read a specific page of a multi-page tiff file, so perhaps you could make a loop to read all of the pages:
    http://java.sun.com/products/java-media/jai/forDevelopers/samples/MultiPageRead.java
    Good luck!

  • How to display more than one column with for each

    Hi guys,
    how to display more than one column with for each like below?
    for each
    Item1
    Item2
    Item3
    Item4
    Item5
    Item6
    Item7
    Item8
    Item9
    Item10
    End for each
    for each          
    Item1     Item2     Item3
    Item4     Item5     Item6
    Item7     Item8     Item9
    Item10          
    End for each

    Take a look at this to see if the solution provided would work for you: https://blogs.oracle.com/xmlpublisher/entry/multi_column_row_woes
    Won't you have more than 10 records in your data file ? If you are going to have only 10 items then you may be able to use position() function to limit it to 3 each..
    Take a look at this: https://blogs.oracle.com/xmlpublisher/entry/turning_rows_into_columns
    Thanks,
    Bipuser

  • The report displays more than 3000 pages with same content.

    Respected Sir
    I have a report with form letter layout.
    The report contains only one page,but while running the paper layout ,the report displays more than 3000 pages with same content.
    please anyone give a solution to this problem

    I think there is no bad joining. b'se when the querry is executed in sql, it is working properly(means returns only one record) . This problem is not for a particular report. Any report using the "form layout", the same problem occurs.
    Why this problem occurs. How can we solve it.
    Bye

  • How to upload a file which has more than 999 line item  through BDC ?

    Hello Techards
    Hi to all
    Can any body tell me how to upload a file which has more than 999 line item  through BDC for traction F-02 ?
    Thanks in advance.
    Shovan

    Hello Shovan,
    You split it up to post two accounting documents with the help of a "suspense" a/c.
    Say, you have to post the following line items below:
    line 1 - dr. - GL a/c X - $1000
    line 2 - cr. - GL a/c Y - $1
    line 3 - cr. - GL a/c Y - $1
    line 1001 - cr. - GL a/c Y - $1
    You cannot post the above as a single doc in SAP (because of technical reasons), so you need to break it up into 2 documents as below:
    Doc1
    line 1 - dr - GL a/c X - $1000
    line 2 - cr - GL a/c Y - $1
    line 3 - cr - GL a/c Y - $1
    line 998 - cr - GL a/c Y - $1
    line 999 - cr - SUSPENSE a/c - $3
    Doc2
    line 1 - dr - SUSPENSE a/c - $3
    line 2 - cr - GL a/c Y - $3
    Note that there is no incorrect impact on accounting as first we credit suspense a/c by $3 and next we debit the same suspense a/c by $3 as a result the effect is nil. Similarly, we credit $997 to GL a/c Y (which is less by $3) in the first doc which is compensated by the second doc by crediting the shortfall of $3.
    Hope this helps,
    Cheers,
    Sougata.

  • I have install io6 and now Music doesn't work, sometimes it stay with a blank page with no possibility to press anithing, sometimes it crash. I have match music active with more than 15000 title. Someone could help me?

    I have install io6 and now Music doesn't work, sometimes it stay with a blank page with no possibility to press anithing, sometimes it crash. I have match music active with more than 15000 title. Someone could help me?

    What is your current Flash Player version: http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html ?
    What is your display adapter, driver version & date?  See http://forums.adobe.com/thread/945765

  • How can I make more than one account with chat on clubwpt?

    I can't make more than one account with chat on clubwpt? i know several players that has made as many as 20 accounts with chat.I can make accounts but clubwpt will not give me chat,they must have my IP address ,because their response is " you r allowed one account with chat only." But as I have said several players have several accounts with chat. Can anyone help me? Are there any programs or plugins that can do this?Any help at all will be greatly appreciate.

    Open another iCloud account for the other user.

  • How can I return files in Trash, more than 1 at a time? I can place many files into Trash at a time.

    I placed many unix.exe files into Trash, more than one at a time. I recently updated 'QuickTime' and the Mac version of 'SilverLight"
    (name might be totally 'correct). I don't know if removing these files can impede my iMac 2008 running OS 10.6.8(updated SnowLeopard).
    I know I can 'return' one file from Trash at a time. When I try to return more than one ('mouse click' and 'drag'
    over 2 or more files, the'return' option isn't listed. Is there a way I can either 'return all' or return more than one file
    at a time?

    Only one at a time. But where are they from? Did you delete system files or are these Windows files (.exe is a Windows extension?)

Maybe you are looking for