Java io question - pls help

Hi all,
I am trying to copy a file in the path "c:\temp\source.txt" to "d:\temp\destination.txt"
Below is the code written by me. It's getting compiled but saying
"The system cannot find the file specified"
Also when i use exists src.exists(); it's returning false.
Some one please help me...
import java.io.*;
public class fileCopy {
     fileCopy() {
     public static void main(String args[]) {
     File src = new File("c:\\temp\\source.txt");
     System.out.println( "Kiran Printing abs file " + src.getAbsoluteFile());
     File dest = new File("d:\\temp\\destination.txt");
     // boolean exists = src.exists();
     // System.out.println( "Kiran Printing exists " + exists );
     System.out.println( "Kiran Printing exists " + src.getAbsolutePath());
     try{
     InputStream in = new FileInputStream(src);
     OutputStream out = new FileOutputStream(dest);
     // Transfer bytes from in to out
     byte[] buf = new byte[1024];
     int len;
     while ((len = in.read(buf)) > 0) {
     out.write(buf, 0, len);
     in.close();
     out.close();
     catch(Exception e)
     System.out.println( "Kiran Printing" + e.getMessage() );
}

I used your code
my o/p
Kiran Printing abs file c:\A.txt
Kiran Printing exists true
Kiran Printing exists c:\A.txt
Check for file.

Similar Messages

  • Java Network Question, pls help

    I need a small help regrading a java program.
    I need to have 3 clients and a server. The programs should communicate via TCP. The server should be called first and waits for a connection request from the clients which are on a different machine that will connect to server. After connection is established, the client prgram prompts the user to type a line of text, send it to server. The server reads the data, reverse it and send it back to the client. After responsding to clients, server should close the connection.
    How can I do this?
    Thanks

    It's completely normal for the client and server to be on different machines. As for example when you used your browser (the client) to connect to this forum (the server).

  • I cant reset my security question pls help me

    I cant find the reset your security question pls help me

    If you mean that you're aren't getting the reset link as described in the steps half-way down this page : http://support.apple.com/kb/HT5312, then that will only show if you have a rescue email address (which is not the same thing as an alternate email address) set up on your account.
    If you aren't getting the link then you don't have a rescue email address, and you won't be able to add one until you can answer your questions - you will need to contact iTunes Support / Apple in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps half-way down the above HT5312 page to add a rescue email address for potential future use

  • Very simple question pls help me

    I just want to use oracle sql and pl/sql workshop isqp*plus web site, so which product or software shouuld i download??? pls help me.
    thanks.

    Pl see your other 2 threads on the same topic (posting the same question multiple times does not make the issue go away ;-) )
    Oracle install error 10g 64 bit windows
    which product should i install??
    HTH
    Srini

  • Simple Servlet question, pls help

    This is my form submission part in my jsp page
    <form name="updateForm" method="POST" action="/Update"> This is my web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <servlet>
        <servlet-name>/Update</servlet-name>
        <servlet-class>UpdateMap</servlet-class>
      </servlet>
    </web-app>This is my UpdateMap.java
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class UpdateMap extends HttpServlet
        public UpdateMap()
    }I put my UpdateMap.class in WEB-INF/classes/ directory but when I clicked the submit button in my jsp page, I got The requested resource (/Update) is not available error

    Found my own error. The jsp submission code should be
    <form name="updateForm" method="POST" action="Update"> But I still got error when submit
    The specified HTTP method is not allowed for the requested resource ( POST method of HTTP is not supported by this URL.)Pls help.
    Thanks

  • Question pls help

    Hi I wanted to ask a question, pls do reply to help me out.
    Can I include a method call to another class, within the same transaction, that performs a
    database statement or must the actual select statement appear within the
    setAutoCommit(false) .....commit()?

    Please elaborate. I believe the answer is yes, but it's not entirely clear what you mean.
    - Phil

  • Java Mapping. Pls help

    Hi,
    Question:
    1. What is java mapping.
    2. How I use java mapping/UDF in message mapping
        for my below scenario
    In my Request XML there are 2 fields.
    In my Response XML there are 2 fields.
    Field 1 of Request XML needs to be mapped directly to
    Field 1 of Response XML.
    Field 2 needs to be passed as paramter to java class and
    java class will be give response that will be mapped to
    Field 2 of Response XML.
    Pls advice . It is urgent.
    Regards

    Hi Rac,
    Java mapping can be used when you have complex mapping structures.
    We can do most of the times for our requirements through Graphical mapping.
    When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.
    Message mapping internally generates DOM parser.
    Java Mapping in XI
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
    SAP Network Blog: Implementing a Java Mapping in SAP PI
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    Java Mapping (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    SAP Network Blog: XI Java Mapping Helper (DOM)
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    SAP Network Blog: Testing and Debugging Java Mapping
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    Binary Conversion in XI - Java Mapping - Code Gallery - Wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava%2bmapping
    SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    Thanks,
    Satya Kumar.
    Reward points if it is useful..

  • Urgent! Cannot run java programme. Pls help!

    1st question:
    I am using JDK 1.3.1_03 on Win2K Server. When I have compiled the java applications, I try to use
    "java <application name>" to run the programme, but an error message "Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object" come up on the screen. Why is it so? It run normally in the past.
    I have upgraded Windows2K once using the Win2K Server CD recently, is it the cause of the problem?
    How can I solve it? Please help! Thank you!
    2nd question:
    I have installed JDK1.4 Final version recently. However, after I have uninstalled it, it still appear in the Add/Remove Programme list in the control panel. I have tried to install another version of JDK, see if it would replace the JDK1.4,
    but it failed. Why is it so? Now when I go to some websites designed by javascript, the Internet Explorer suddenly closed by itself. How can I solve the problem? Please help! Thank you!

    Hi,
    I got the same problem, 1st question, running the application on win NT. Is there anybady there who can help us!!!??????????

  • HT5787 I forget my security question pls help me

    Pls I need your help I forget my answer of security questions what I do ?

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
    Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                             Apple ID- All about Apple ID security questions.

  • Newbie question pls help!

    hey new to java and struggling writing my first program cant get rid of this error any ideas?
    The error is:- symbol : method StringValue ()
    location: class java.lang.String
    String newColour = (colourInput.getText()).StringValue());
    please help should be easy if you know what ur doin but i dont and its drivin me crazy

    I think yawmark is in broken-record mode today. Not just today. I keep a fairly large file of
    cut-n-paste responses accumulated while addressing
    the same issues over and over and over.... I'm not at work today, so I have a lot of time to hang out here (too cold to do anything outside), and that particular response about spelling things out just seemed to pop up a lot today (no doubt caused by the posters who popped up today). A file of cut-and-paste responses is definitely a handy thing to have around here...I don't have such a file myself...I only just started here a couple of months ago, but the questions do indeed get repetitive! My cell phone only receives SMS messages--it doesn't have the capability to send them--so I don't write any SMS messages. Even if I did, I can't imagine why people think it is okay to abbreviate everything here into SMS-speak.
    yawmark, good luck on your test! Thanks!!!You're welcome!

  • MSI-6585 (648 MAX) instant restart issues questions pls help......

    Hi, i figured after months of specualation i would try to figure out what the hell is wrong with my pc.  12months ago a bought a MS-6585 648 MAX mobo and a P4 2.53ghz with 2x Samsung DDR 333 (PC2700) ram.  I play many games on my pc it seems when playing Counter-Strike + PlanetSide results in random instant restarts.  Occasionaly it will just hang the system but mainly instant reset of the system.  My cpu temp ranges from 35 48 max approx.  
    I've tried switching my ram to different slots and so on refit everything but with no luck.  I just have a very unreliable computer atm.  I've reformated plenty of times but with no joy, the odd thing is its random somtimes my pc will not crash or reset it self so this makes it very difficult to figure out what the hell is going on :S
    If you have more questions perhaps i can answer them - and give you more info that i have forgotten.
    Here are somethings that might be useful:
    MS-6585 648 MAX mobo
    Pentium 4 (northwood) 2,53ghz 533
    Samsung DDR 333 (PC2700)
    Gigabyte Maya II Radeon 9700Pro (running in agp 8x)
    Sound Blaster Audigy 2 Platinum
    Bios settings: (things ive changed)
    Turned onboard sound off than auto
    AGP Apeture size  128
    I have 32bit transfer mode running for hdds
    I have S.M.A.R.T. enabled
    (next week end i will have another 512 ram stick to try just incase its my ram but i have done the intel ram checker and it didn't find any problems)
    Any help would be greatly appreciated pls ask any things ive missed and anything else u would need to know.  I really want to sort this out as you can imagine its not very nice having a pc that can randomly crash when u do not expect it.

    Overclocking is typically limited by one of 3 factors, assuming you have sufficient power:
    1. Memory won't operate past a certain speed, so you run at a different ratio or buy faster memory.
    2. Temperature, so you need to add non-stock cooling or better case ventilation or water cooling, depending on how far you want to go
    3. CPU - At some point the CPU won't run any faster.
    Leave the CPU voltage at Auto. You should only need to raise it if you get into extreme overclocking.
    As for the size of the power supply, if you stay with Intel Northwood with an ATX board on your next upgrade, an Enermax 465, Antec 480, or something similar (should cost around $80-100US) would get good choices. If you plan on going with a Prescott on an ATX board, I would look at going to a 550W supply.
    Personally, I thing the next 12 months is shaping up to be a real headache in making upgrade decisions in the Intel world. Intel have indicated their next generation of boards will be BTX without AGP support. This looks like an upgrade could mean new case, possibly power supply, video card and possibly ram. I am hoping that companies like MSI will produce a transitional product that allows new processors and chip sets on an atx board. If that doesn't happen I see a lot of people switching to AMD.

  • Problems with async callback with the BPEL Java API (Urgent- pls help)

    Hi,
    I have an async BPEL process and I invoke it form a JSP page using BPEL java API.
    I have followed the tutorials and docs at:
    $SOA_HOME/bpel\samples\tutorials\102.InvokingProcesses\rmi\com\otn\samples\async
    I can inititiate successfully the process, but when I try to get the result using getResult() or getField(String fieldName) methods I get the error:
    Oct 2, 2007 2:35:16 PM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    java.lang.ExceptionInInitializerError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:242)
         at com.evermind.io.ClassLoaderObjectInputStream.resolveClass(ClassLoaderObjectInputStream.java:33)
         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
         at com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:856)
         at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:287)
         at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
         at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.util.MissingResourceException: Can't find bundle for base name com.collaxa.cube.i18n.exception_cube, locale en_US
         at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
         at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
         at java.util.ResourceBundle.getBundle(ResourceBundle.java:699)
         at com.collaxa.cube.CubeException.getResourceBundle(CubeException.java:142)
         at com.collaxa.cube.CubeException.<clinit>(CubeException.java:82)
         ... 17 more
    07/10/02 14:35:16 java.lang.ClassCastException: java.util.MissingResourceException
    07/10/02 14:35:16      at com.oracle.bpel.client.delivery.ext.async.thread.AsyncInstanceWatchdog.run(AsyncInstanceWatchdog.java:152)
    I check for the result only after I have checked that the instance is closed (completed or faulted) by using IInstanceHandle:getState() and InstanceHandle.STATE_CLOSED_COMPLETED, or IInstanceHandle.STATE_CLOSED_FAULTED
    I would like to add that so far I had no problems with invocation and geting result of sync BPEL processes. I do not what is missing for async processes.
    Any kind of help is appreciable.
    Thanks and best regards,
    Evanela

    Hi again,
    i managed to solve the problem:) Totally stupid.. the process variable name was not specified correctly..., but more stupid sounds the error message:))))
    Best Regards,
    Evanela

  • About Memory Leak in JAVA Any body pls help me

    Hi All,
    In our application, with JAVA we are using c, c++ native methods also.
    The problem is, Eventhough the application is in idle state, the Virtual Memory occupation is getting increased. For 24 hours, 30 MB is increased, while the application is in idle state.
    Is there any possiblity, this much memory leak can happen in JAVA. or it is from Native c side..
    I would appreciate anybody' s help.

    Thanks
    I am using JProfiler for that. I can observe what kind of objects not getting freed and the size of memory it is taking. and i observed thro JProfiler, that is only 16 kb of memory leak is happening. Can Any body who is well known about JProfiler help me. Can i differentiate the memory leak from JAVA and Native C side using JProfiler.
    Any help would be appreciated.

  • Clarity required on these questions pls help?

    HI ,
    Need your help in solving these questions, these are questions asked in during interviews
    a) Dyamic actions, how to create a customer specific dynamic action , specify configured fields and rules?
    b) how to create Customer specific infotype, , please explain with any example with which are the fields you have created
    c)    Msn 10, 20, 30
    d) Revision  infotypes
    e) What are the  infotypes which cannot be enhanced
    f) What is log, How can we cancel and edit it?
    g) What is Ap/b
    h) Which is Default feature for wage types
    i) What are Infosets
    Thanks and Regards
    j) Define Benefit area

    You can do as suggested already and use interface nodes and cross component mapping; but that is all really not necessary.  It creates a situation where you calling application is too dependent upon the freely programmed input help.  You want to try to avoid the situation where the calling application needs code or mappings to communicate with the input help.
    That is easy to do because the framework passes all the information you need into the freely programmed input help via the value_help_listener object. 
    Part of the Freeley Programmed Input Help Component should be the component interface IWD_VALUE_HELP.  This comes with a component controller method called SET_VALUE_HELP_LISTENER.  This allows your freely programmed value help to capture this object called listener of type IF_WD_VALUE_HELP_LISTENER. I generally just store it awa into a component controller attribute.
    With this listerner object you have direct access to the context attribute in the calling component. You can query information about the calling UI element and of course set values directly back into it.  The listener is a hugely helpful object and should be the way you interact with the calling component whenever possible.  Here is small example:
      set single attribute
      wd_this->value_help_listener->f4_context_element->set_attribute(
      exporting
        name = wd_this->value_help_listener->f4_attribute_info-name
        value = l_time

  • Easy Java GUI Question Please Help!

    Please help! whenever I try to run this code:
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    mport javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
         setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
         public void paint(Graphics g){
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    this keeps happening http://www.youtube.com/watch?v=k7htCX6a4BI&feature=watch_response
    (I didn't post this video but it looks like I'm not the only one this has happened to)
    its like I get a weird screen capture :/
    I tried setting the bacgkround color and I tried using netbeans instead of eclipse. neither worked.
    Any help would be really great! I don't want to get discouraged from learning java!

    First of all it contains Syntax error .
    Call the super paint method when trying to override the paint method .
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    import javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
    public void paint(Graphics g){
    // call the base paint method first
    super.paint(g);
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    Edited by: VID on Mar 31, 2012 5:05 AM

Maybe you are looking for

  • Alpha keys are locked on wireless keyboard?

    The iMac wireless keyboard will not type alpha characters but is paired and batteries are good. Help? Isctheirca lock command that I should use to reverse an accidental lock?

  • Another Flash question

    Hey folks-- I've created a site with some Flash buttons for navigation. I created them within Dreamweaver MX 2004. I'm using Mac OSX. Here's the problem: when I upload the files to the server, the flash button links work in Safari. They do not work i

  • Substition exit

    I am re-posting this coz i think i had posted it in the wrong section. hello All, I tried to resolve this issue on my open about the user exit for obbh transaction, Also had a look at all the threads but i could not locate one. I need to populate the

  • RemoveAttribute doesn't seem to do so.

    I am trying to do this in an <img id='player' src=' ' alt='alt' title='title' border='0' onerror="document.getElementById('player').removeAttribute('src');document.getElementById('player').removeAttribute('alt');document.getElementById('player').remo

  • Weblogic WEB CENTER 11g

    Hi, I have installed oracle weblogic serevr 10.3.3 I have installed oracle web center 11g I have configured weblogic domain using web center configuration in my machine C:\Oracle\Middleware\Oracle_WC\common\bin\config.cmd I am unable to start managed