JNA loadLibrary() method shows an error with arguments“cannot find symbol method drawImage(java.awt.image.BufferedImage,<nulltype>,int,int)”'Must Override a Superclass Method' Errors after importing a project into EclipseJava: when to use static methodsMaking a mocked method return an argument that was passed to itDownload a file with Android, and showing the progress in a ProgressDialogWhy this class should implement java.io.Serializable when I using hibernate?How to reference a method in javadoc?Can someone show me a simple working implementation of PagerSlidingTabStrip?why spill failure happens for Custom Data Type in HadoopHow do I rectify the Native.loadlibrary error
Is TA-ing worth the opportunity cost?
What happen to those who died but not from the snap?
(11 of 11: Meta) What is Pyramid Cult's All-Time Favorite?
AsyncDictionary - Can you break thread safety?
Why are Gatwick's runways too close together?
What costs less energy? Roll or Yaw?
Continuous vertical line using booktabs in tabularx table?
What should I call bands of armed men in Medieval Times?
Withdrew when Jimmy met up with Heath
Are differences between uniformly distributed numbers uniformly distributed?
What are the conventions for transcribing Semitic languages into Greek?
What is my malfunctioning AI harvesting from humans?
Trying to write a shell script that keeps testing a server remotely, but it keeps falling in else statement when I logout
If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?
Is it okay for a ticket seller to grab a tip in the USA?
What game uses dice with sides powers of 2?
How is this kind of structure made?
Are there any financial disadvantages to living significantly "below your means"?
Who are these characters/superheroes in the posters from Chris's room in Family Guy?
Is refreshing multiple times a test case for web applications?
Infeasibility in mathematical optimization models
Blocking people from taking pictures of me with smartphone
Help evaluating integral (anything simple that I am missing?)
Te-form and かつ and も?
JNA loadLibrary() method shows an error with arguments
“cannot find symbol method drawImage(java.awt.image.BufferedImage,<nulltype>,int,int)”'Must Override a Superclass Method' Errors after importing a project into EclipseJava: when to use static methodsMaking a mocked method return an argument that was passed to itDownload a file with Android, and showing the progress in a ProgressDialogWhy this class should implement java.io.Serializable when I using hibernate?How to reference a method in javadoc?Can someone show me a simple working implementation of PagerSlidingTabStrip?why spill failure happens for Custom Data Type in HadoopHow do I rectify the Native.loadlibrary error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to set image as a desktop wallpaper using Java. I found a solution in the internet but it does not work. I can't understand what is wrong with it.
Here is what it says to me?
Can you help me?
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinDef.UINT_PTR;
import com.sun.jna.win32.*;
import java.util.HashMap;
public class WallpaperSetter
public interface SPI extends StdCallLibrary
//from MSDN article
long SPI_SETDESKWALLPAPER = 20;
long SPIF_UPDATEINIFILE = 0x01;
long SPIF_SENDWININICHANGE = 0x02;
//Here is the problem
SPI INSTANCE = (SPI) Native.loadLibrary("user32", SPI.class, new HashMap<Object, Object>()
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
);
boolean SystemParametersInfo(
UINT_PTR uiAction,
UINT_PTR uiParam,
String pvParam,
UINT_PTR fWinIni
);
public static void setWallpaper(String image_url)
String path = image_url;
SPI.INSTANCE.SystemParametersInfo(
new UINT_PTR(SPI.SPI_SETDESKWALLPAPER),
new UINT_PTR(0),
path,
new UINT_PTR(SPI.SPIF_UPDATEINIFILE
java jna
add a comment |
I want to set image as a desktop wallpaper using Java. I found a solution in the internet but it does not work. I can't understand what is wrong with it.
Here is what it says to me?
Can you help me?
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinDef.UINT_PTR;
import com.sun.jna.win32.*;
import java.util.HashMap;
public class WallpaperSetter
public interface SPI extends StdCallLibrary
//from MSDN article
long SPI_SETDESKWALLPAPER = 20;
long SPIF_UPDATEINIFILE = 0x01;
long SPIF_SENDWININICHANGE = 0x02;
//Here is the problem
SPI INSTANCE = (SPI) Native.loadLibrary("user32", SPI.class, new HashMap<Object, Object>()
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
);
boolean SystemParametersInfo(
UINT_PTR uiAction,
UINT_PTR uiParam,
String pvParam,
UINT_PTR fWinIni
);
public static void setWallpaper(String image_url)
String path = image_url;
SPI.INSTANCE.SystemParametersInfo(
new UINT_PTR(SPI.SPI_SETDESKWALLPAPER),
new UINT_PTR(0),
path,
new UINT_PTR(SPI.SPIF_UPDATEINIFILE
java jna
Well, that error message says that the map parameter is expected to be aMap<String, ?>
but you're providing aMap<Object, Object>
.
– Thomas
Mar 27 at 8:39
Ok. I changed toMap<String, Object>
and now when I choose an image it sets orange color as an desktop image
– Nikita
Mar 27 at 8:45
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11
add a comment |
I want to set image as a desktop wallpaper using Java. I found a solution in the internet but it does not work. I can't understand what is wrong with it.
Here is what it says to me?
Can you help me?
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinDef.UINT_PTR;
import com.sun.jna.win32.*;
import java.util.HashMap;
public class WallpaperSetter
public interface SPI extends StdCallLibrary
//from MSDN article
long SPI_SETDESKWALLPAPER = 20;
long SPIF_UPDATEINIFILE = 0x01;
long SPIF_SENDWININICHANGE = 0x02;
//Here is the problem
SPI INSTANCE = (SPI) Native.loadLibrary("user32", SPI.class, new HashMap<Object, Object>()
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
);
boolean SystemParametersInfo(
UINT_PTR uiAction,
UINT_PTR uiParam,
String pvParam,
UINT_PTR fWinIni
);
public static void setWallpaper(String image_url)
String path = image_url;
SPI.INSTANCE.SystemParametersInfo(
new UINT_PTR(SPI.SPI_SETDESKWALLPAPER),
new UINT_PTR(0),
path,
new UINT_PTR(SPI.SPIF_UPDATEINIFILE
java jna
I want to set image as a desktop wallpaper using Java. I found a solution in the internet but it does not work. I can't understand what is wrong with it.
Here is what it says to me?
Can you help me?
import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinDef.UINT_PTR;
import com.sun.jna.win32.*;
import java.util.HashMap;
public class WallpaperSetter
public interface SPI extends StdCallLibrary
//from MSDN article
long SPI_SETDESKWALLPAPER = 20;
long SPIF_UPDATEINIFILE = 0x01;
long SPIF_SENDWININICHANGE = 0x02;
//Here is the problem
SPI INSTANCE = (SPI) Native.loadLibrary("user32", SPI.class, new HashMap<Object, Object>()
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
);
boolean SystemParametersInfo(
UINT_PTR uiAction,
UINT_PTR uiParam,
String pvParam,
UINT_PTR fWinIni
);
public static void setWallpaper(String image_url)
String path = image_url;
SPI.INSTANCE.SystemParametersInfo(
new UINT_PTR(SPI.SPI_SETDESKWALLPAPER),
new UINT_PTR(0),
path,
new UINT_PTR(SPI.SPIF_UPDATEINIFILE
java jna
java jna
edited Mar 29 at 2:54
shizhen
5,7009 gold badges21 silver badges47 bronze badges
5,7009 gold badges21 silver badges47 bronze badges
asked Mar 27 at 8:35
NikitaNikita
91 bronze badge
91 bronze badge
Well, that error message says that the map parameter is expected to be aMap<String, ?>
but you're providing aMap<Object, Object>
.
– Thomas
Mar 27 at 8:39
Ok. I changed toMap<String, Object>
and now when I choose an image it sets orange color as an desktop image
– Nikita
Mar 27 at 8:45
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11
add a comment |
Well, that error message says that the map parameter is expected to be aMap<String, ?>
but you're providing aMap<Object, Object>
.
– Thomas
Mar 27 at 8:39
Ok. I changed toMap<String, Object>
and now when I choose an image it sets orange color as an desktop image
– Nikita
Mar 27 at 8:45
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11
Well, that error message says that the map parameter is expected to be a
Map<String, ?>
but you're providing a Map<Object, Object>
.– Thomas
Mar 27 at 8:39
Well, that error message says that the map parameter is expected to be a
Map<String, ?>
but you're providing a Map<Object, Object>
.– Thomas
Mar 27 at 8:39
Ok. I changed to
Map<String, Object>
and now when I choose an image it sets orange color as an desktop image– Nikita
Mar 27 at 8:45
Ok. I changed to
Map<String, Object>
and now when I choose an image it sets orange color as an desktop image– Nikita
Mar 27 at 8:45
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11
add a comment |
1 Answer
1
active
oldest
votes
Ok. All is needed to change Map<Object, Object>
to Map<String, Object>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372805%2fjna-loadlibrary-method-shows-an-error-with-arguments%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ok. All is needed to change Map<Object, Object>
to Map<String, Object>
add a comment |
Ok. All is needed to change Map<Object, Object>
to Map<String, Object>
add a comment |
Ok. All is needed to change Map<Object, Object>
to Map<String, Object>
Ok. All is needed to change Map<Object, Object>
to Map<String, Object>
answered Mar 30 at 14:22
NikitaNikita
91 bronze badge
91 bronze badge
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372805%2fjna-loadlibrary-method-shows-an-error-with-arguments%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Well, that error message says that the map parameter is expected to be a
Map<String, ?>
but you're providing aMap<Object, Object>
.– Thomas
Mar 27 at 8:39
Ok. I changed to
Map<String, Object>
and now when I choose an image it sets orange color as an desktop image– Nikita
Mar 27 at 8:45
Well, that seems to be another problem which I can't help solve because I don't really know the user32 library. I'd suspect your parameters are wrong so check those as well as the documentation. If you still got stuck, provide a minimal reproducible example (code, the image you want to set and an image of what you get instead) in a new question since this one is about compilation problems.
– Thomas
Mar 27 at 8:51
Thank you. I managed it myself. It sets only pictures which are downloaded to your PC. I was trying to set a picture which does not exist on computer.
– Nikita
Mar 27 at 9:06
@Nikita Welcome to Stack Overflow. To save time for those of us who want to help you, please use the answer section to answer your question to show how you solved it, so we don't have to read the comments thread to know this still isn't an active question!
– Daniel Widdis
Mar 27 at 16:11