How to write to the file

Hello
Please help me
I have a question,
I try to write variables in the file.
FileOutputStream ot=new FileOutputStream("minor.txt");
ot.write(ints5);//ints5- string variable
ot.close();
but compilator gives;Incompatible type for method
can't convert jav.lang.String to byte[]

string path="d:";
string s1;
File logFile=new File(path,"kuku.txt");
FileOutputStream ot=new
FileOutputStream(logFile,getPath(),false);
PrintWriter pwoutF1=new PrintWriter(ot,false);
pwoutF1.write(s1);
What do i wrong?????For starters, the PrintWriter set up is wrong.
Try this:
public class FTest {
    static String ints5 = "The number 5";
    public static void main(String [] args) {
        File file = new File(args[0]);
        try {
            PrintWriter ot = new PrintWriter(new FileOutputStream(file));
            ot.println(ints5);
            ot.close();
        } catch (Exception ex) { }
}Also:
It should be File.getPath() not File, getpath().
The boolean arg to FileOutputStream sets append, it should probably not be false for a log file?
You might as well use the println() method of PrintWriter.
jch

Similar Messages

  • The Microsoft Access database engine cannot open or write to the file in Report Builder 3.0

    I am trying to build a report in Report Builder 3.0.  I created the Data Source to point to my Excel file and the Data Set.  I drag a couple of fields on to the canvas and then choose Run.  I get the error:  "The Microsoft Access
    database engine cannot open or write to the file.  It is already opened exclusively by another user".  I am using the Excel driver.  Why am I getting this message?  How can I fix this?

    No, now I am getting the error message again.  It is quite long:
    ERROR [HY000] [Microsoft][ODBC Excel Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
    ERROR [01S00] [Microsoft][ODBC Excel Driver]Invalid connection string attribute Trusted_Connection
    Please help

  • How can I delete the files .DS_store in Mac OS Yosemite?

    How can I delete the files .DS_store in Mac OS Yosemite?

    The .DS_Store file is normal. It holds certain settings related to the folder it is found in. Removing these files is futile, as they will come back, as you have observed.
    If you are seeing them on your Mac, that means you have changed settings so that your Mac is showing invisible files in the Finder. To reverse that, run the following command in the Terminal:
    defaults write com.apple.finder AppleShowAllFiles NO
    This will hide them, and any other invisible files, from view.
    If you are seeing them on a Windows machine, just ignore them. They're not doing any harm.
    If you found a Terminal command that is supposed to stop them from being created, I would be extremely skeptical as to the wisdom of running it.

  • HELP!!!!!! - How to write into a file?

    How to write into a file?
    I want to make a script that will connect(not enter) to my website[for example, www.vasa.com] every time i connect to the internet.
    Now i have 3 problems:
    1. i dont know how to write into a file
    2. i dont know how to make it connect to my 'server' without entering the website
    3. i dont know what file to write it to
    so if someone can help me, please do.

    Well, how about RTFM?? In this case that can be found here:
    http://developer.java.sun.com/developer/onlineTraining/
    BTW - these things have been asked azillion times, search the forum.

  • How to write a CSV file in OSB

    Hi All,
    can any one tell me How to write a CSV file in OSB?
    Thanks.

    Hey, I couldnot find any xsl usage inside pipeline pair in the links given by you. Do you have any links that gives a sample example.I could not find any links with examples. I will send you a simple config jar demonstrating the use of XSLT resources/transformations.
    secondly should MFL doc replicate the name(s)of the nodes of the source xsd:I'm not sure If I understood your question.Can you please explain?
    Ex: My database schema looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="CountriesCollection" type="CountriesCollection"/>
    <xs:complexType name="CountriesCollection">
    <xs:sequence>
    <xs:element name="Countries" type="Countries" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Countries">
    <xs:sequence>
    <xs:element name="countryId">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="2"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="countryName" minOccurs="0" nillable="true">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="40"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="regionId" type="xs:decimal" minOccurs="0" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    and the corresponding MFL that I have created gives this output
    <?xml version="1.0" encoding="windows-1252"?>
    <countriesCollection1>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    </countriesCollection1>
    Why I am asking this beacuse there is an error that i am getting:
    Jun 19, 2009 5:50:50 PM IST> <Error> <JCATransport> <BEA-381951> <JCA inbound r
    quest only invocation failed, exception: java.security.PrivilegedActionExceptio
    : com.bea.wli.sb.transports.TransportException: Binary to XML mfl transformatio
    failed for the MFL Resource Database-Jms-File/Database-File/MFLSample : null
    ava.security.PrivilegedActionException: com.bea.wli.sb.transports.TransportExce
    tion: Binary to XML mfl transformation failed for the MFL Resource Database-Jms
    File/Database-File/MFLSample : null..................................................
    Any help?
    Regards
    PS

  • I want a stamp to write to the file metadata and be able to display the result in windows explorer.

    I want a stamp to write to the file metadata and be able to display the result in windows explorer. I have read PDF Stamp Secrets and can write to Custom Metadata but don't know how to display that custom field in explorer. Can I have the stamp write to a standard (non-custom) metadata field? Or, how do it get the custom field to display in explorer? Windows is pretty stingy with the file details it displays for PDF files, in fact there are no editable fields provided (like are available for Office files).   I want this to work for multiple users hopefully without having to get the IT group involved to make (or allow) system modifications to make this work. Any ideas? Thank you.

    Metadata for Windows Explorer is tagged with different names than the metadata for PDFs. Acrobat cannot copy the metadata to the tagged items of the file header.
    There are tools like EXIFTool that can manipulate the data as necessary. Phil Harvey also provides the details about the file types and their metadata tags and values so you should be able to map the tags that need to be updated.

  • How to write run.bat files

    Can anyone tell me how to write run.bat files to run java classes. Currently my run.bat file has the following two lines,
    c:\j2sdk1.4.1_02\bin\javac.exe *.java
    c:\j2sdk1.4.1_02\bin\java.exe questionnair
    But the class is not executed. Thanks in advance.

    you'll have to provide more details.
    Firstly, which package is the class a part of? and secondly, where on the filesystem is the root of the package?
    You might also benifit from placing the c:\j2sdk1.4.1_02\bin\ into the classpath.
    On a rainy day, check out the ANT tool, it will take care of all that crapola for you.
    newio

  • How to check Whether the File is in Progress or used by some other resource

    Hi All,
    I am retrieving a file from the FTP server using Apache commons FTP.
    I need to check whether the file is fully retrieved or in progress.
    for now i can able to use the file which is partially retrieved. it is not throwing any file sharing exception or i am unable to find whether it is in progress.
    How to check whether the file is in progress ? or The file is accessed by some other resource ?
    Pls Help me.
    Thanks,
    J.Kathir

    Hi Vamsi,
    Explicitly such kind of requirement has not been catered and i dont think you would face a problem because any application that is writing to a file will open the file in the read only mode to any other simultaneous applications so i think your concerns although valid are already taken care off .
    In the remote case you still face a problem then as a work around. Tell the FTP administrator to set the property to maximum connections that can be made to ftp as one. I wonder if you have heard of the concept of FTP handle , basically the above workaround is based on that concept itself. This way only one application will be able to write.
    The file adapter will wait for its turn and then write the files.
    Regards
    joel
    Edited by: joel trinidade on Jun 26, 2009 11:06 AM

  • I need to convert PDF file to Word Document, so it can be edited. But the recognizing text options do not have the language that I need. How I can convert the file in the desired of me language?

    I need to convert PDF file to Word Document, so it can be edited. But the recognizing text options do not have the language that I need. How I can convert the file in the desired of me language?

    The application Acrobat provides no language translation capability.
    If you localize the language for OS, MS Office applications, Acrobat, etc to the desired language try again.
    Alternative: transfer a copy of content into a web based translation service (Bing or Google provides a free service).
    Transfer the output into a word processing program that is localized to the appropriate language.
    Do cleanup.
    Be well...

  • I have an older macbook circa 09 and purchased a new macbook pro 2012. The older one has been backed up to an older time capsule. How do i move the files to my new macbook?

    I have an older mackbook pro circa 2009, i thought it died on me it just went completely black. I later found out just a bad battery i purchased a new one in the interim. Now that i have discovered the problem i bought an older time capsule and backed up the older macbook i now want to transfer my personal files to my new macbook pro to maintain one personal mackbook. How can i move the files from my time capsule to my newer macbook pro?
    thank you in advance for your help!!

    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • I downloaded an Adobe file from my email but cannot find it on my hard drive or in recycle bin - it's in downloads but am unable to open from downloads - how can I recover the file?

    I downloaded an Adobe file from my email (service provider is MWeb) but now cannot find it on my hard drive and it's not in the recycle bin. It does, however, appear in Firefox downloads but I'm unable to open it from there. How can I recover the file?

    Thanks Rob.
    I actually had no clue what the core problem was caused by. So it's Windows itself...that helps some.
    I'll resubmit there. It might actually have saved time for it to simply have been moved to there instead of off-topic, though I suppose you have to follow protocol.

  • My laptop was stolen and with it my itunes, all of my music (including non-apple downloaded content) is still on my iphone 5, how can I transfer the files to my new laptop which is authorised to the same apple ID?

    my laptop was stolen and with it my itunes, all of my music (including non-apple downloaded content) is still on my iphone 5, how can I transfer the files to my new laptop which is authorised to the same apple ID?

    See this user tip for recovering the media from the iPhone: https://discussions.apple.com/docs/DOC-3991

  • HT4796 How can I take the files that were migrated from my PC to my Mac and add all those files to my current user instead of having 2 users?

    How can I take the files that were migrated from my PC to my Mac and add all those files to my current user instead of having 2 users? Having to log out just to sign in on a different user to access the files is absurd.
    Do I make all the files sharable to all the NOW users on the mac then just delete the files? Or can i erase my account that I made when starting up my new mac and then just use the one with the transferred files?
    I just dont want to have to og in and out of 2 different accounts .. Help please.         
    -Nina

    Sorry. /Users is a folder path. It would be similar to C:\Users (if that exists on Windows).
    So, in the Finder, select Computer from the Go menu.
    You'll see Macintosh HD, double-click that to open it.
    In there you'll see several folders. One is Users. That is where all the user Home folders exist. Select the other account's home folder and go to step 3.
    If you have any more confusion, please stop and ask. We'll get there.
    If you feel more comfortable, you can just log into that other account and move the files into /Users/Shared.
    Then, log into the account you wish to use and copy the files from the Shared folder and paste them into your Home folder, wherever they belong, Documents, Music, Pictures, etc.  That just takes a little more work. Transferring them into Shared, and then copying into your home sets the permissions on the files so that you won't have a problem accessing them later. The steps I provided just prevent you from having to do the double move, since you are not going to use the old account once you are done.
    Quick unix shorthand. If someone gives you a file path that begins with a /, that means the root of the hard drive, ie Macintosh HD (if you haven't renamed it). The path separator in unix is /, not \.
    A path that starts with ~/ means your Home folder, the one inside /Users named with your account name.

  • How do I find the file size of my presentation in keynote for iPad?

    I know this is a simple question, and I have a work around by just emailing the file to me, but I want to know how I can see the file size as I work on the file within keynote.....on the iPad.
    Thanks

    Select the album, Select all photos in the album, then click on the info button.   Number of photos and total size are on  top of info pane.

  • How do I get the file names on a customized proof sheet?

    How do I get the file names on a customized proof sheet?

    Actually, I really don't know what you say.
    But when you see the properties of a file in Windows, you can see there are two file size. One is called "SIze" and the other one is called "Size on disk".
    Therefore, I would like to know the size on disk but not just the size.

Maybe you are looking for

  • Image Capture saving files to the wrong folder

    This happens pretty consistently. I select the folder I want to download my pictures/movies to and it downloads to one of my previously selected folders. How can I fix this so that it places the files in the folder I specify?

  • Where are my photos stored?

    When I import pictures in iphoto from my SD memory card where do the pictures get stored?  Another words, what directory do I look under in Finder to find them?  Same thing with movies download from my SD card.

  • PP-PI - Control key

    Hi guys, I have an issue with capacity requirements generated by process orders. I have been experimenting with the control keys to show the appropriate behaviour, but this does not seem to be the case. The following happens When I put the same contr

  • Shuffle will not play...just green light

    I consider myself pretty technically savvy but I cannot get this thing to PLAY!!! I turn it on, the light turns green, I hold down the play button and turn up the volume - nothing. Even tried different headphones. I am going on 6 hours. I have alread

  • When using Pages to create an EPUB file, how would I force a page brake?

    when using Pages to create an EPUB file, how would I force a page brake?