【发布时间】:2011-06-01 10:44:58
【问题描述】:
【问题讨论】:
【问题讨论】:
看起来您需要将 NSWorkspace 类映射到 JNA。在 JNA 中定义一个扩展 Library 类的接口。然后将setDesktopImageURL:forScreen:options:error: 方法映射到 JNA。
【讨论】:
以下是不使用 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);
}
学分
【讨论】: