Questions tagged [getresource]
283 questions
1
vote
1 answer
Android NullPointerException while invoking virtual method Context.getResource()
I have a task of inflating the view for the object a class called "ToDoItem" using a relative layout for this class named todo_item.xml .I have just started to learn android programming and i cant figure out why i am getting the following error.
…

Marib Sultɐn
- 5
- 3
1
vote
1 answer
NetBeans getting resource inside JAR file?
I have been trying to include some images and sounds in my Netbeans Java project and I have searched all over google looking for answers all of which I have tried and implemented but some play the audio file correctly when running it inside Netbeans…

AlpaxJ1
- 125
- 3
- 12
1
vote
2 answers
Android Studio can't find Resuorces
This is the error message which shows up when I run the apk on my virtual device.
05-03 13:00:03.652 2354-2354/de.hochrad.hochradapp I/art﹕ Not late-enabling -Xcheck:jni (already on)
05-03 13:00:05.966 2354-2354/de.hochrad.hochradapp…

Finn von Holten
- 108
- 10
1
vote
1 answer
JavaFX getResource return null when running in browser
I have a javafx application and I store all fxml files in src/foo/bar/fxui folder. I use the code below to refer to fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/foo/bar/fxui/file.fxml"));
Parent root = (Parent)…

Li Siyao
- 83
- 9
1
vote
2 answers
NullPointerException using getResource
I'm trying to create some application to recognize faces, following this tutorial. However, whenever I run the code below, I get this error: Exception in thread "main" java.lang.NullPointerException
class DetectFaceDemo {
public void run () {
…

Adriano Valente
- 529
- 5
- 15
1
vote
1 answer
Executing wmv file packaged in jar
I want to execute the wmv video file present in PicturePackage.
i am using following code:
try {
File f;
f = new File(getClass().getResource("/PicturePackage/admin_input.wmv").toURI());
Desktop.getDesktop().open(f);
}…

ashu
- 1,197
- 2
- 14
- 30
1
vote
0 answers
Custom Fonts in Java - getResourceAsStream not working in IntelliJ IDEA but DOES work in JAR
I'm trying to package my Java application so that other people can run it. I have no experience with this as I've always dealt with the applications through the IDE. I'm using a custom font and I use the code
vectorFont =…

SeniorShizzle
- 984
- 1
- 11
- 27
1
vote
2 answers
getResource causing NullPointerException
I know there have been multiple posts on the subject but my issue seems to be one that hasn't been brought up yet. Under no circumstance can I seem to get getResource to correctly return a path location. It got to the point where I try to find the…

user3194585
- 33
- 4
1
vote
1 answer
Processing 2.0 Movie cannot open movie file when running from jar
I'm trying to run a movie using the Processing 2.0 Movie class.
If I run my program from my code editor (Eclipse in my case) everything works fine and the code runs flawlessly: it locates and starts the movie.
However, when I export my program to a…

Rijstkoek
- 241
- 1
- 2
- 12
1
vote
3 answers
ModX revo 2.2x: How to use a TV value to set tpl?
I'm trying to figure out a way to render a resource with a specific tpl based on a template variable(tv) value. here is my use case:
I have setup a modx installation for a basic site with a homepage and a blog (I used the articles add-on). I want…

user2251230
- 25
- 2
- 5
1
vote
2 answers
Java Swing: unable to load image using getResource
I'm trying to isolate where the problem could be when trying to add an image to the class directory. (Doing this so when I export as a runnable JAR, the image is included in the package).
So I've got the strawberry.jpg file sitting in…

Synapse
- 13
- 1
- 4
1
vote
2 answers
How to get resources working in runnable jar?
I have a Image Icon in my Jframe.I am using a Image in it.When i export into a Runnable Jar.The Image is Not displayed.
String iPath = "res/images/Mobile.png";
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setBounds(0, 0, 315, 610);
…

AruLNadhaN
- 2,808
- 5
- 24
- 42
1
vote
1 answer
Loading resources with a .jar Applet
I've made an simple applet which loads an image which is included in the .jar-file that I've made. The project has one package named "kap12" and one class named "U1". I have one folder included named "resrc" where my image is located. This folder is…

Kalekulan
- 13
- 5
1
vote
1 answer
ClassLoader getResourceAsStream not loading some files in same dir
My issue is that I am able to load some files within the same directory but not others.
The following will return null on a few files consistently:
ClassLoader.getSystemClassLoader().getResourceAsStream(pathStr)
A subset of paths found in the jar…

Baracs
- 139
- 1
- 6
1
vote
1 answer
how to get inputstream from class file existed in other project
I am trying to get inputstream from class file of the other project.
I am using eclipse. The output folder is:
mycurrentproject/WebContent/WEB-INF/classes.
The export library folder is:
mycurrentproject/WebContent/WEB-INF/lib.
When I print…

Nick Dong
- 3,638
- 8
- 47
- 84