Can I change wallpaper of windows 7 using Java code?
Here's my code:
public class Changer {
/**
* @param args
*/
public static native int SystemParametersInfo(int uiAction,int uiParam,String pvParam,int fWinIni);
static
{
System.loadLibrary("user32");
}
public int Change(String path)
{
return SystemParametersInfo(20, 0, path, 0);
}
public static void main(String args[])
{
String wallpaper_file = "D:\\Photos\\walli\\dream girls\\jes54d.jpeg";
Changer mychanger = new Changer();
mychanger.Change(wallpaper_file);
}
}
This code in Eclipse IDE failed. I am getting this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.changer.Changer.SystemParametersInfo(IILjava/lang/String;I)I
at com.changer.Changer.SystemParametersInfo(Native Method)
at com.changer.Changer.Change(Changer.java:18)
at com.changer.Changer.main(Changer.java:25)
I am new to Java and couldn't figure out what would be the possible solution.
Thanks in advance.