Results 1 to 5 of 5
  1. #1
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

    Default excute cmd command

    Java Code:
      Runtime rt = Runtime.getRuntime();
      Process proc = rt.exec("net start OracleDBConsoleORCL");
    i wrote this code to execute the command to start oracle service inside java, but i have a problem that this command require administrator privileges :eek::confused:

    OS: windows 7 .

    please i need help ?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,534
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jperson View Post
    Java Code:
      Runtime rt = Runtime.getRuntime();
      Process proc = rt.exec("net start OracleDBConsoleORCL");
    i wrote this code to execute the command to start oracle service inside java, but i have a problem that this command require administrator privileges :eek::confused:

    OS: windows 7 .

    please i need help ?
    There's nothing Java can do about it; you need Administrator privileges.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

    Default

    thank u JosAH for your reply,,

    my idea is to make a batch for the command and when the user want to execute the command , the program open the batch folder and ask him to execute it with administrator privilege .

    any ideas more efficient??

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,534
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jperson View Post
    thank u JosAH for your reply,,

    my idea is to make a batch for the command and when the user want to execute the command , the program open the batch folder and ask him to execute it with administrator privilege .

    any ideas more efficient??
    Not really; your program needs those privileges, no matter what. Executing a batch file is as good as any other option.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

    Default

    can i run my jar file with administrator privilege ? if yes .. how ?

Similar Threads

  1. excute command
    By jperson in forum New To Java
    Replies: 4
    Last Post: 07-13-2010, 08:48 AM
  2. Does the JRE come with command to run?
    By gotenks05 in forum New To Java
    Replies: 5
    Last Post: 10-25-2008, 12:00 AM
  3. command
    By dirtycash in forum New To Java
    Replies: 8
    Last Post: 01-02-2008, 07:52 PM
  4. command help
    By dirtycash in forum New To Java
    Replies: 1
    Last Post: 12-05-2007, 12:24 AM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 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
  •