Questions tagged [getresource]
283 questions
0
votes
1 answer
JAR Export throws Null pointer exception on getClass().getResource()
I cloned this project from GitHub in Eclipse (requires Maven to set up quickly). I may or may not tweak it, but I want to export it into a JAR file.
https://github.com/eugener/oxbow
When I run the test main method in in…

tmn
- 11,121
- 15
- 56
- 112
0
votes
4 answers
Calling getResources() ten times Android
so as my question says, I am in a situation where I need to get ten different strings using getResources() and then compare them to a string the user enters.
This is how I'm doing it currently:
if(string == getResources().getString(R.string.x))…

Dakshin
- 437
- 1
- 6
- 16
0
votes
1 answer
Absolute path to file outside of project folder with getResourceAsStream()
I want to create jar which will read txt fom jar and then save txt file to user.home folder. When it is runned again, it will read file from user.home.
I read file like…

Wlad
- 410
- 1
- 9
- 27
0
votes
0 answers
Change icon from android resource to icon in assets folder (setIcon)
I'm currently working on a cloud wallpaper application built from source code on Github. While going through the code I found that two icons are pulled from the Android resources. I'm curious how I can make it so that the icons are resources in my…

Infinite1224
- 31
- 3
0
votes
1 answer
JButton.setIcon throws null pointer when file exists
OK, so I had an issue where my images weren't showing when the .jar file was run.
Fixed that by using a fix from robberman I think his tag was.
Anyways once I fixed that by getting the images from getResourceAsStream etc it worked fine. So when…

Jason Langois
- 41
- 1
- 8
0
votes
1 answer
Modx getResource: Choosing which resource loads first?
I am trying to use getResource to pull a few resources into a single page, then these resources link through to a detailed information page of the specified resource.
[[getResources? &tpl=`profile-ditto` &limit=`all` &parents=`18`…

josh
- 15
- 6
0
votes
1 answer
getResource(String name) returns null?
First off, I would like to address that this question is very similar to the one here:getResources() returns an empty Enumeration . I chose to ask this because mine is more of a question of JAR files, as well as because the former question has yet…

SecondThread
- 108
- 2
- 11
0
votes
1 answer
Problems with the getImageList call
It seems that my getImageList call in my ModX website doesn't work. I've got a template calling to the slider chunk. In the slider chunk is the following code:

Marco Geertsma
- 803
- 2
- 9
- 28
0
votes
2 answers
How to get a item with identificator from a R.array.element?
I have an array in the Array.xml from resources folder with the next content.
- 1
- song1
- 2
-

Víctor Martín
- 3,352
- 7
- 48
- 94
0
votes
4 answers
How to give relative path in java getResources()
I am using eclipse juno for the java application and want to load an image on application and for that I am writing following code
URL imageURL = LoginWindow.class.getClassLoader().getResource("resources/img/pause.png");
which gives the following…

Uday A. Navapara
- 1,237
- 5
- 20
- 40
0
votes
2 answers
How to use modx getResources to return the parent resource one time only?
How can I use getResources to get the parent resource from several nodes in a resource tree ~only once~ i.e. I have a getResources call:
[[!getResources?
&parents=`738,746,1222, 748, 1216, 805, 806, 807, 3401`
…

Sean Kimball
- 4,506
- 9
- 42
- 73
0
votes
1 answer
Using getResourceAsStream after build isn't working?
In my Java project in netbeans I get a text files contents to populate some internal data structure using this:
InputStream PFile = this.getClass().getResourceAsStream("../../IISP Details/IISP.txt"); // Get File to create IISP's
String[]…

user3495579
- 23
- 1
- 4
0
votes
1 answer
Get resource name of an image in android
I need to change an image according to the image that is currently visualized.
I know how to set an image :
image.setImageResource(R.drawable.car1);
but now I need to do the opposite. Knowing that image is in R.id.carOk I must know which drawable…

userSimo
- 165
- 3
- 12
0
votes
1 answer
Java - Cannot get MIDI file as resource
I originally had my .mid file in the project directory and I had got it like this:
File file = new File("hmr.mid");
It all worked fine, then I tried to export it to a runnable .jar, because than I had NullPointerException when I tried to access…

user1105818
- 13
- 5
0
votes
0 answers
Images changing as JComboBox selection changes and exporting as .JAR
I have my JLabel change as a JComboBox selection changes. I had originally used:
ImageIcon icon2 = new ImageIcon(ClassLoader.getSystemResource("images/image.png"));
and an action event which worked fine with the compiler. When I tried to export it…

user3413189
- 3
- 1