Results 1 to 8 of 8
  1. #1
    bernerd is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Default affinity setting and jar launching in linux.

    Hi all,

    I'm trying to launch a jar as a process in linux and at the same time trying to set the affinity of the process.
    I'm able to do it in windows in the following codes. However, I'm not sure how do to it in linux.

    Runtime r = Runtime.getRuntime();
    Process p = null;
    String s = "cmd.exe /c start /affinity " + affinity + " java -jar \"myJar.jar\"";
    p = control.r.exec(s);

  2. #2
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default Re: affinity setting and jar launching in linux.

    no need to use the cmd.exe just use the "cmd /c start /affinity " + affinity + " java -jar \"myJar.jar\"";
    p = Runtime.getRuntime().exce(s) or r.exec(s);

    I think it will help you.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default Re: affinity setting and jar launching in linux.

    @dinesh.guntha
    What does the OS do differently if you use the cmd.exe command vs the cmd command? What extension does the OS add to a "command" to find the file to be executed?

    Is there a command named cmd on linux?

  4. #4
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default Re: affinity setting and jar launching in linux.

    nothing difference is ther but i tryed by using cmd.exe it was not working. so that i used with cmd it was working fine.
    In the above code he is using the control.r.exec(s).
    what is the "control"?
    That also may be a case that it is not able to execute.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: affinity setting and jar launching in linux.

    Quote Originally Posted by dinesh.guntha View Post
    nothing difference is ther but i tryed by using cmd.exe it was not working. so that i used with cmd it was working fine.
    In the above code he is using the control.r.exec(s).
    what is the "control"?
    That also may be a case that it is not able to execute.
    You're totally missing the point. Read the first three sentences of the original post.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    bernerd is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Default Re: affinity setting and jar launching in linux.

    Runtime r = Runtime.getRuntime();
    Process p = null;
    String s = "cmd.exe /c start /affinity " + affinity + " java -jar \"myJar.jar\"";
    p = r.exec(s);

    sorry for the confusion. control is the class which I had declared r.

  7. #7
    bernerd is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Default Re: affinity setting and jar launching in linux.

    Quote Originally Posted by Norm View Post
    @dinesh.guntha
    What does the OS do differently if you use the cmd.exe command vs the cmd command? What extension does the OS add to a "command" to find the file to be executed?

    Is there a command named cmd on linux?
    yes, I believe this is where the problem lies at actually. can't seem to find the right way to call the cmd in linux.

  8. #8
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

Similar Threads

  1. Launching an exe
    By kanupriya in forum New To Java
    Replies: 19
    Last Post: 01-19-2011, 10:24 AM
  2. Replies: 11
    Last Post: 12-12-2010, 06:27 AM
  3. setting the "Java classes" directory in Linux
    By mr_anderson in forum Advanced Java
    Replies: 1
    Last Post: 08-02-2010, 07:18 AM
  4. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  5. Setting path under Linux to recognize jre
    By cccccc in forum New To Java
    Replies: 4
    Last Post: 03-31-2009, 06:51 AM

Posting Permissions

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