Not able to rename the existing file

Hi All,
I have a java file Test.java in which i am doing the following stuffs.
1) I am creating a new file
2) Entering contents in the existing file
3) Renaming the existing file--When i am doing this i am not getting any error but the existing file is not renamed
The contents of the file Test.java*************************
package com.fidelity.ereview.utils;
import java.io.*;
public class Testing {
     public static void main(String[] args) throws IOException {
          File f = new File("D:/TCS/myfile1.txt");
          f.createNewFile();
          System.out.println("new file " + f + " is created");
          FileOutputStream fileobj = new FileOutputStream(f);
          DataOutputStream writeInsideFileObj = new DataOutputStream(fileobj);
          writeInsideFileObj.writeBytes("sunita");
          writeInsideFileObj.writeBytes(",");
          writeInsideFileObj.writeBytes("choudhury");
          File f2 = new File("D:/TCS/myfile2.csv");
          f.renameTo(f2); **// renames the file HERE The file is not renamed**
Kindly anybody help me....

import java.io.*;
public class Testing {
public static void main(String[] args) throws IOException {
//File f = new File("D:/TCS/myfile1.txt");
File f = new File("D:/TCS/myfile2.csv");//above replaced by
f.createNewFile();
System.out.println("new file " + f + " is created");
FileOutputStream fileobj = new FileOutputStream(f);
DataOutputStream writeInsideFileObj = new DataOutputStream(fileobj);
writeInsideFileObj.writeBytes("sunita");
writeInsideFileObj.writeBytes(",");
writeInsideFileObj.writeBytes("choudhury");
writeInsideFileObj.close();//I added
fileobj.close();//I added
//File f2 = new File("D:/TCS/myfile2.csv");
//f.renameTo(f2); **// renames the file HERE The file is not renamed**
}Why create a file add data to the file and then rename to change the file type?
You can add data to any file type with java.

Similar Messages

  • Not able to open the existing PDF files from Content Server in VL02N

    Hi All,
    In Delivery transaction VL02N, we are not able to open the PDF file attachments which were created in the Past (Ex. 01/01/2014) from the Content Server. Recently upgraded to Enhancement Pack 7 and not sure whether the issue is due to this upgrade.
    Kindly check and do the needful.
    Thanks,
    Parasuram

    Hello,
    What error or information did you met?
    Are there any information in transaction SLG1?
    Regards,
    David

  • Not able to read the wsdl file from server Premature EOF encounter

    Hi All,
    I am facing issue while accessing a web Service from server. Here is the clear view about it.
    I created a simple SyncBpel process in a composite and deployed in to the server and it is working fine. Later i created a new Asyn bpel process in a composite and in the external reference i dragged a web Service and imported the wsdl url from server of the SyncBpel and wired the Asynbpel process to webserive .
    Now here i am facing peculiar behavior which i am not able to trace it out.
    1) For the first time when i import the url of syncBpel from the server i am not facing any error and it is working fine as expected but when i close the Jdeveloper and open it i am not able to user the web Service and it is saying as "Not able to read the wsdl file from server Premature EOF encounter"
    2)When i close and open the Jdeveloper i can see the url of the wsdl which imported in webserver is changing from http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep?WSDL to http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/BPELsync.wsdl
    3)when I open and see the url http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep?WSDL I can see the soap address as *<soap:address location="http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel!1.0*soa_5cfb8416-c106-40a2-a53b-9054bbe04b9c/bpelsync_client_ep"/>*
    I don’t understand why the soap end contains “*soa_5cfb8416-c106-40a2-a53b-9054bbe04b9c” and this kind of url for soap address is coming to all the bpel process which I am deploying in the server.
    I checked the in Jdeveloper where webproxy is uncheck and the server is also up but still I am facing issue of reading the error.
    Can someone please help in resolving the issue.
    I am using SOA 11g 11.1.1.5 and Jdeveloper 11.1.1.5
    Many thanks.
    Tarak
    Edited by: user11896572 on Jan 17, 2012 5:22 PM

    Hi,
    Setting default from the jdeveloper -
    During composite deployment from Jdeveloper (wizard driven), you will be given an option to choose the version of the composite and there will also be an option for you to choose if the composite needs to be deployed as default.
    Setting default from the em console -
    After deploying a composite, login to the em console and click on the composite that you want to set as default, and you will find a tab - "Set as Default". please note that this tab will not be seen, if the composite is already set as default.
    Refer -
    http://docs.oracle.com/cd/E12839_01/integration.1111/e10226/soacompapp_mang.htm
    8.2 Managing the State of Deployed SOA Composite Applications
    Thanks

  • Ipod as hard disk - Why am I not able to see the whole file?

    I'm using my 80 gig 5th gen ipod as a hard disk for the first time. I've dragged a 32 KB text file to the ipod. When I scroll though the file all is great...but I'm not able to see the whole file? It's like I get one page and that's all. Any ideas to help me?

    Do you mean the Notes function? If so, the file size per note is, I believe, 4k. Therefore, you'd need to break up a 32k file into several parts or it will be truncated.

  • Reg: not able to edit the property file.

    Hi,
    I have imported the track and in one of the DC i am not able to edit the properties file. What could be the reason.
    Thanks in advance.

    Hi
    Since you are in Track.
    Which propertyu file ???
    Best Regards
    Satish Kumar

  • Weblogic Classpath setting error not able to pick the properties file

    Hi All,
    We are using a third party jar and create a java Web service on the top of that jar. This jar file need two configuration file .properties and .xml when we deploy war for the application into weblogic server it will give file not found error. Though this file already exists inside the .war but from the application it is not able to pick the files.
    We find that these file need to be put in weblogic domain home and we put it there and application works.
    I decompile the jar and found that inside java class they use FileReader("allXXX.xml") path and when I Google it and found that it will pick the file from weblogic domain directory.
    The issue is that we need to put properties file in specific weblogic folder like /3party/config by setting the class path inside startWebLogic.cmd. Please let us know solution for same
    Thanks in advance
    Edited by: sb**** on Mar 19, 2012 9:08 AM

    Hi , I am also facing the similer issue. I am deploying war file of my Spring MVC application , but its not picking resource bundle .properties files from one of the configuration file.
    <bean id="PropertiesRepository"
              class="LanguageBasedPropertiesRepository">
              <property name="propertiesFiles">
                   <map>
                        <entry key="en" value="classpath:/exceptionMessages.properties" />
                        <entry key="es" value="classpath:/exceptionMessages_es.properties" />
                        <entry key="default" value="classpath:/exceptionMessages.properties" />
                   </map>
              </property>
         </bean>
    Please let me know how we can modify this to make it work.
    thanks .

  • Not able to see the TPZ files

    Hi,
    Please help.
    I am facing a problem while transporting a request to Production environment. I am using File Level Transport. When I create a transport file, it is successfully created in development system's /export location. Basis team moves the file production system's /import directory.
    But here I am not able to see the imported  tpzfile via Tool->import design objects , in Production environment.

    Hi,
    Please find below from sap help.
    After a successful import, the Integration Builder moves the imported TPZ files into the directory <systemDir>/xi/repository_server/importedFiles. The support package stack of imported software component versions is displayed on the Details tab page for the relevant software component version in the Integration Builder. If an error occurs, this information is important for support. Take one of the following precautions to retain the overview of the imported XI content:
    ●      If the release and the support package stack are clear from the file name of the TPZ file, simply leave the files in the directory importedFiles (see above).
    If a file with the same file name already exists in the directory importedFiles, the Integration Builder adds the date and time of the import to the file name of the imported export file. This enables you to check which file was imported last.
    ●      After a successful import, you can keep the packed files, from whose naming convention you can derive the support package stack. Move them into the directory importedFiles, for example.
    If version conflicts occur during the import, you can process and resolve them in the Enterprise Services Builder. In the case of corrupt export objects, you can force the import and skip objects that cannot be imported. The import is then incomplete and references to objects that are not imported are lost.
    Regards,
    Venkata S Pagolu

  • OSB throwing IO Exception : Could not able to rename the file

    Hi, 
    I am trying to publish the file in an SFTP location. OSB is able to write the file with extension .a (which it generally does while writing), but couldn't able rename it to the original name.
    Error From Logs :
    BEA-381801> <Error occured for endpoint com.bea.wli.sb.transports.TransportException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    com.bea.wli.sb.transports.TransportException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    Caused By: java.io.IOException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    Solutions Tried :
    1) All the permissions are there to read and write on that folder.
    2) In the remote SFTP logs there is no activity recorded for attempting to rename the file from OSB.
    Please suggest.
    Thanks,
    Ankit

    Use a JCA adapter.
    Create adapter in Jdeveloper and import the artifacts in to OSB.
    The native support of OSB for SFTP doesn't work sometimes

  • Not able to run the mxml file (Browser window is not launching)

    Hello All,
    I have flex 2.0 version installed on my window xp desktop. I have created one very simple form using TextInput and Label (Like:Video 04: Using Pre Built Flex Controls) but when I am clicking on the "Run" button at top near Print icon nothing is happening and I am not able to see form in browser window( window is not launching).
    I have attached the flex project screen shot. (ProjectScreen.gif)
    Do anyone have any idea why it is happening.
    I would appreciate your help.
    Thanks & Regards,
    Chetan Tyagi

    Got It !!
    I have re-installed the flex builder 2 again and now its working file.

  • I am not able to download the music files i purchased several days ago

    My account hacked. I know that because person changed the security question but not the password. I made a purchased recently. Purchased songs and there was a previous two book purchase from Apple Store. When i try to download them to my Mac, i am receiving this error message:" This computer is already associated with an Apple ID. You can download past purchases on this computer with just one Apple ID every 90 days. This computer can be used with a different Apple ID in 90 days. " I downloaded the music files on my windows and my mini ipod. Nowhere else.
    I have two more Apple ID i use to purchase products.
    Also is there a way to combine these two Apple IDs so all my purchases will be under one Apple ID.
    Thanks for any help

    Hi Suchvas,
    Thanks for visiting Apple Support Communities.
    If you are not able to download an iBooks update from the App Store, start with these troubleshooting steps:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Regards,
    Jeremy

  • I am not able to see the trace files for SQL query

    Hello, I am using windows vista OS.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL>
    I enabled the trace as below
    alter system set timed_statistics=TRUE
    alter system set sql_trace=TRUE
    After this, I ran sql query from scott as below.
    select count(*) from emp;
    After this, i checked in user dump directory. The trace files are generating... But this sql code is not appearing in the trace files...
    Am i missing anything... Any help is appreciated.
    Thanks

    This may happen when the trace file is not completely closed.You may try again doing like this,
    alter session set sql_trace=true;
    select * from emp;
    alter session set sql_trace=false;After this,disconnect and exit from your session as well. This should close the file completely and you should be able to see your command in it.
    HTH
    Aman....

  • I am not able to open the.json file when I try to save my bookmarks.

    I tired to back up my files but it does not open in any program.
    In addition, I downloaded the AOL toolbar and spent an hour putting my information I wanted on the toolbar and then the tool bar disappeared.

    JSON files aren't meant to be opened directly. When you back up your bookmarks, the JSON file that is created can be used to restore that backup or to move your bookmarks to another computer. You do that by opening the Library window ("Show all bookmarks"), clicking on "Import and Backup -> '''Restore'''" option and choosing that backup file. See this article for details:
    *[[Restore bookmarks from backup or move them to another computer]]

  • Not able to source the env files after setting in bash profile

    Hi All,
    su - oracle
    cd /u01/app/oracle/PROD/db/tech_st/11.1.0
    cat PROD_oracleerp.env >> /home/oracle/.bash_profile
    In the similar way i set up the environment settings in case of application tier too
    su - applmgr
    cd /u01/app/oracle/PROD/apps/apps_st/appl
    APPSPROD_oracleerp.env >> /home/applmgr/.bash_profile
    I also followed other ways to source the env files like
    I added the following into the "/home/oracle/.bash_profile" file.
    /u01/app/oracle/PROD/apps/apps_st/appl --APPL_TOP
    /u01/app/oracle/PROD/inst/apps/PROD_oracleerp --INST_TOP
    /u01/app/oracle/PROD/apps/apps_st/comn --COMMON_TOP
    I tried many ways but could not switch to appropriate home directory and run the env variables .
    Can you please help on this

    su - oracle
    cd /u01/app/oracle/PROD/db/tech_st/11.1.0
    cat PROD_oracleerp.env >> /home/oracle/.bash_profileJust add the following to the user's profile and it will be sourced for you (you do not even need to change directory and source the env file manually then):
    . /u01/app/oracle/PROD/db/tech_st/11.1.0/PROD_oracleerp.env
    In the similar way i set up the environment settings in case of application tier too
    su - applmgr
    cd /u01/app/oracle/PROD/apps/apps_st/appl
    APPSPROD_oracleerp.env >> /home/applmgr/.bash_profile
    . /u01/app/oracle/PROD/apps/apps_st/appl/APPSPROD_oracleerp.envThanks,
    Hussein

  • I am not able to download the .dmg file for my mac book pro. pls help.

    i am using a mac book pro - mac os x 10.6.4 on a 2.33 ghz intel core duo processor. i am unable to fully download the .dmg file to install firefox. the file begins download within the browser itself and the browser window screen goes black after a while and stays there. no .dmg file to be seen. pls help.

    The latest version iOS 6 does not run on the original iPad.  That's why you cannot download it.

  • Not able to find the source files for org.w3x Node.java Nodelist.java

    hey guys, Im deploying an applet on a users network that only has 1.4.2, and the xml parsing files node.java and nodelist.java are needed. I would like to add the files to my source code myself but i am unable to find them anywhere within my jdeveloper files. I keep finding stubbs. Where might I be able to find these? Thanks a lot!

    java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
         at customertree.XmlLoader.readData(XmlLoader.java:127)
         at customertree.XmlLoader.<init>(XmlLoader.java:69)
         at customertree.CustomerTreeFinal.jbInit(CustomerTreeFinal.java:240)
         at customertree.CustomerTreeFinal.init(CustomerTreeFinal.java:858)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source
         at java.lang.Thread.run(Unknown Source)and then inside the code... this is where i get my first error
    clients.setRowId(list2.item(i).getTextContent());

Maybe you are looking for

  • How to populate the TEXT field in MIGO

    Hi folks, While creating material document in MIGO or MB01, i am inserting some data in TEXT ( Field in line item level ). This text data is disappearing , once mat doc is created. how to populate the TEXT field in MIGO?Is there any cusomisation?it's

  • Error when connecting a sap machine with another sap machine

    Hello, Sap machine 'A' calls the object bus2010 of sap machine 'B'. I indicate in the call the system logic and destination RFC. System logic and destination RFC are OK in both systems. When calling the system 'B' an error 'Expected error in SP clien

  • Background in Nokia MixRadio doesn't change.

    The problem is very simple, when you add your favorite artists in the app, the background should change and show those artists. The thing is my app shows the first artist I added almost a year ago when I first opened MixRadio and no matter what I do

  • Rejection of Shopping Cart created in SRM ?

    Hi SRM GURUS, We have an issue regarding shop on behalf in SRM. A shopping cart is created as shop on behalf and needs approval from a manager. If the manager rejects it, then the shopping cart is returned to the user that has been shopped on behalf

  • Photos in Windows Explorer folders marked as empty

    I am using Windows 7 64 bit.  My photos are readily available in the appropriate folders when I look at them within Lightroom, Browser or Photoshop.  But if I open Windows Explorer, those same folders are marked as "Empty."  This did not happen until