Results 1 to 3 of 3
  1. #1
    switch's Avatar
    switch is offline Member
    Join Date
    Jan 2012
    Location
    U.S.A.
    Posts
    19
    Rep Power
    0

    Default Runtime and Commands for Mac

    I would like to know if anyone knows how to execute, command + option + Q using Runtime.getRuntime().exec("//code here"); this is for mac os x lion. I have a problem with the preview app. There is no com.apple.Preview.savedState folder... believe me, I've looked everywhere it could or should be and its not there and have changed the system preferences to stop it but Preview still shows previous images after reopening. I could just use the command + option + Q keys to close the last opened image in preview, but this is a program and it should be automatic. I've solved the problem by writing a different program using JInternalFrames, but I like using the simpler and smaller program. Right now I'm using Runtime.getRuntime().exec("killall Preview"); but that command only closes the Preview.app. When the program needs to open another image, it opens the new image plus the previous image and or images. killall Preview is a mac terminal command, but I don't know how to execute command + option + Q in the terminal. If I did I could get this to work. any suggestions?

    switch(i) {
    case 0: execute this;
    break;
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,455
    Rep Power
    20

    Default Re: Runtime and Commands for Mac

    What's the preview (or maybe Preview) app?

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

  3. #3
    switch's Avatar
    switch is offline Member
    Join Date
    Jan 2012
    Location
    U.S.A.
    Posts
    19
    Rep Power
    0

    Default Re: Runtime and Commands for Mac

    Preview is a built in application that come pre installed with mac os x. It is an imaging application kind of like mspaint, except a little more advanced. To open with java you can use
    Runtime.getRuntime().exec("open -a Preview.app"); -a is mac terminal command for the applications folder. As for windows you could use Runtime.getRuntime().exec("cmd /c start mspaint.exe " + imagepath); imagepath being a user defined string that includes the path, filename and filename extension to the file.

Similar Threads

  1. AT commands in JAVA
    By donpeter06 in forum Advanced Java
    Replies: 2
    Last Post: 01-06-2012, 07:58 AM
  2. CMD is not reading commands
    By colonial in forum Forum Lobby
    Replies: 1
    Last Post: 03-15-2010, 03:36 AM
  3. Problem with Runtime.getRuntime().exec with Linux Commands
    By swapnilnawale in forum Threads and Synchronization
    Replies: 1
    Last Post: 09-23-2009, 11:23 PM
  4. Using Runtime to execute external commands
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 10:14 AM
  5. Windows Runtime Commands
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-04-2008, 10:33 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
  •