Results 1 to 7 of 7
  1. #1
    sushil is offline Member
    Join Date
    Oct 2009
    Posts
    8
    Rep Power
    0

    Exclamation Transfer a process to remote machine

    hi
    i am doing a project in java. i have to transfer a process(code) to another computer execute over there and get result back.while using this code i am able to copy current process (code) in to another directory but i have to transfer process to another machine execute over there and get result back.
    if any one have solution of this problem plz help me out it's urgent.

    import java.io.*;
    public class dload
    {
    public static void main(String arg[])
    {
    Process p = null;
    Runtime rt;
    try
    {
    rt = Runtime.getRuntime();
    p=rt.exec("cmd /c copy g:\\sushil\\dload.java d:\\newdir"); // '/c' means execute the command.
    // It will copy running process(dload.java) to destination(d);;;

    }
    catch(Exception e)
    {
    System.out.println(e);
    }
    }
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    dload.java isn't a process. It's a java source file.
    Little more than a text file, at this stage.

  3. #3
    sushil is offline Member
    Join Date
    Oct 2009
    Posts
    8
    Rep Power
    0

    Default

    ok can u plz send me a code how to transfer a code to remote machine and execute overthere and get result back

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    I really don't understand what you're trying to do.
    If you want to run something on the other machine you ought to simply deploy it there first...
    What you're proposing sounds like a slightly dubious architecture to me.

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    You can move object instances between JVM's using ObjectOutputStream and ObjectInputStream. You'll need a socket connection between the machines as well.

  6. #6
    sushil is offline Member
    Join Date
    Oct 2009
    Posts
    8
    Rep Power
    0

    Default transfer process

    Actually I have to transfer a process to remote pc

    (i.e) suppose a big addition is there let's take 900 digit and we hve to perform addition operation on that number for that i hve to divide those number in to multiple process (eg) 1+2+3+4... ( 1+2) as first process and (3+4) second process first process is transfer to Remote pc and perform addition operation and second process will performed locally
    so i hve to know how to transfer process and get back the result
    plz help me out

  7. #7
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I assumed you already had a JVM running on the remote machine, that is acting as a socket server. The remote machine waits for a socket connection from a client. Once the connection is established, you have lots of options for handling client requests. I suggested using ObjectStream to move objects back and forth between the machines, but that's just one of many valid approaches.

    Draw a picture of what you want to accomplish. Add details as you make decisions about what you actually want to do and how to do it. Once you understand what you want to do and generally how to do it, you can start coding and asking specific questions.

Similar Threads

  1. Replies: 10
    Last Post: 02-28-2012, 09:44 PM
  2. Java program to ping remote machine using IP address..?
    By prabhurangan in forum New To Java
    Replies: 19
    Last Post: 11-22-2011, 04:58 PM
  3. Remote deploy and remote work with JBoss AS
    By chalda in forum Eclipse
    Replies: 2
    Last Post: 03-08-2010, 12:17 PM
  4. How do i share one process or service from remote machine in p2p
    By vishal.babar07@gmail.com in forum New To Java
    Replies: 1
    Last Post: 02-13-2009, 07:18 AM
  5. how to load a file in remote machine
    By christina in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •