Professional Web Applications Themes

How to make my mac restart (from Java or Perl) ? - Mac Programming

Hi there ! I'd like to make my mac restart, from a Java or Perl program. Does a Java or Perl package exist somewhere to make this easy ? I suppose it's quite simple using AppleScript, but I'm precisely not a Mac programmer, only a Unix programmer (C++, Java, Perl, shell...) : as a result, I'm not familiar with this technology. But I prefer a response with AppleScript rather than none ! iMac DV400, MacOS 10.2.6 (DevTools installed) Thanks ! Fred...

  1. #1

    Default How to make my mac restart (from Java or Perl) ?

    Hi there !

    I'd like to make my mac restart, from a Java or Perl program.
    Does a Java or Perl package exist somewhere to make this easy ?

    I suppose it's quite simple using AppleScript, but I'm precisely not a
    Mac programmer, only a Unix programmer (C++, Java, Perl, shell...) :
    as a result, I'm not familiar with this technology.

    But I prefer a response with AppleScript rather than none !

    iMac DV400, MacOS 10.2.6 (DevTools installed)

    Thanks !

    Fred
    Fred Guest

  2. #2

    Default Re: How to make my mac restart (from Java or Perl) ?

    In article <google.com>,
    com says... 

    Since you're happy with UNIX stuff what's wrong with a shell script and
    'shutdown'?
    James Guest

  3. #3

    Default Re: How to make my mac restart (from Java or Perl) ?

    In article <google.com>,
    com (Fred) wrote:
     

    tell app "Finder" to restart

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  4. #4

    Default Re: How to make my mac restart (from Java or Perl) ?

    In article (Dans l'article)
    <Individual.NET>,
    James Weatherley <net> wrote (écrivait):
     

    Maybe this method would kill every application thus not letting them save
    preferences and doents?

    Fred, the only way to restart nicely is, AFAIK, to send an AppleEvent.
    Meeroh gave you the AppleScript way which is definitely the simplest one.
    However, he sent the AppleEvent to the Finder which does work but I prefer
    to send it to System Events since System Events daemon is supposed to run
    all the time while the Finder can be quitted by user with a lot of add-ons
    including some that add a Quit menu item (like TinkerTool).

    So the line in AppleScript could be what Meeroh wrote or:

    tell app "System Events" to restart

    For Perl, you can just use the osascript command line tool as in:

    osascript -e 'tell app "System Events" to restart'

    and embed this in a system call or whatever.

    I know you didn't ask for C/C++ but there's a technote about this in C:
    http://developer.apple.com/qa/qa2001/qa1134.html

    This could be used as the mainline if you wanted to write the thing in Java
    with JDirect3 or in Cocoa/Java.

    Paul

    --
    Philosophie de baignoire - consultations sur rendez-vous.

    NPDS: http://newton.kallisys.net:8080/
    Apache: http://www.kallisys.com/
    Paul Guest

  5. #5

    Default Re: How to make my mac restart (from Java or Perl) ?

    In article <free.fr>,
    com says... 
    >
    > Maybe this method would kill every application thus not letting them save
    > preferences and doents?
    >[/ref]

    Harsh but fair ;)
    James Guest

  6. #6

    Default Re: How to make my mac restart (from Java or Perl) ?

    In article <Individual.NET>,
    James Weatherley <net> wrote:
     
    > >
    > > Maybe this method would kill every application thus not letting them save
    > > preferences and doents?
    > >[/ref]
    >
    > Harsh but fair ;)[/ref]

    It's the UNIX way!

    Let people save? Bah, the one-second grace period between SIGTERM and
    SIGKILL is *already* too generous!
    Michael Guest

Similar Threads

  1. Replies: 2
    Last Post: February 8th, 03:22 PM
  2. Have to quit and restart Distiller 6 to make additional PDF's
    By Mike_Nicastre@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 1
    Last Post: December 11th, 07:41 PM
  3. [JAVA] - To Make training of JAVA, help me Underestand FLEX and AS 3.0 ?
    By Eduardo Burko - Dotmidia in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: August 31st, 02:33 PM
  4. Restart ColdFusion to make it running
    By zeuda20 in forum Coldfusion Server Administration
    Replies: 1
    Last Post: July 25th, 04:57 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139