2011-06-01 21 views

回答

0

這裏是你如何能做到這一點,而不JNA。

public void setWallpaper(File file) 
throws Exception { 
    String as[] = { 
      "osascript", 
      "-e", "tell application \"Finder\"", 
      "-e", "set desktop picture to POSIX file \"" + file.getAbsolutePath() + "\"", 
      "-e", "end tell" 
    }; 
    Runtime runtime = Runtime.getRuntime(); 
    Process process; 
    process = runtime.exec(as); 
} 

現金

https://stackoverflow.com/a/5007344/1401250

https://sourceforge.net/p/jawc-wallpaperc/code/HEAD/tree/trunk/Jawc/src/it/jwallpaper/platform/impl/MacPlatform.java#l38