in Education by
Before... (question deleted) I'm trying to make a runnable jar from a Swing project. I add some images in /img folder. Previous version didn't have it and runnable jar was good through export in Eclipse. Now I guess something is going wrong. In runnable jar I added at same level of main package and META-INF folder, this img folder but it seems GUI does not appear. Some process before building GUI went good so main class seems ok. Any suggestion!? Thanks. Comments : Run it on the command line and post the error you get. – Kevin Any suggestion!?. Yes. post the structure of the jar file, the code which fails, and the stack trace of the exception you get. Otherwise, I don't see how we could help you. – JB Nizet Did you plop some images into a path the classloader can see? – Perception After.... So I found the problem, still not the solution: As I said, I manually put /img inside jar as you can see by first screenshot: http://img94.imageshack.us/img94/1691/screenshot021ep.jpg But nothing happens, now I put /img outside jar and GUI starts: http://img21.imageshack.us/img21/1551/screenshot022jj.jpg So, how can I package /img folder or icons for my app? Thanks. PS: cmd line didn't print anything, the app starts and does some things right except for GUI building. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
In Eclipse, create a new source folder called "resources". Then, put your image file in the same package as your class, but in your "resources" folder. By doing this, you can use the following code to get your image as input stream: ClassName.class.getResourceAsStream(imageFileName);

Related questions

0 votes
    How to insert different types of slides and images into the slides and apply animation and transition on them Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Which of these method is used to implement Runnable interface? (a) stop() (b) run() (c) runThread( ... division Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    The strategy of making processes that are logically runnable to be temporarily suspended is called : Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
0 votes
    Differentiate between the Thread class and Runnable interface for creating a Thread?...
asked Jan 19, 2021 in Technology by JackTerrance
0 votes
    I'm trying to put several images together into one big image, and am looking for an algorithm which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm trying to put several images together into one big image, and am looking for an algorithm which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm trying to populate my menu items with an image/logo on each of the third menu list, please see example below. I've ... . Sorry i'm new to this, any help would be appreciated....
asked Mar 2, 2022 in Education by JackTerrance
+1 vote
    __________ takes in raw data and transforms into charts, graphs and images that can flawlessly explain numbers in a marvelous way to gain insights from it...
asked Oct 11, 2020 in Education by anonymous
0 votes
    A bundled package is a package that's been compressed into a ______ file. (a) Double (b) Triple (c) ... Regression of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I would like to document in the shaded jar what maven artifacts actually end up in that shaded jar. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
    I think it goes without saying that I should be able to use Oracle's own JDK with JavaFX (from ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I want to load and execute external jar file using URLClassLoader. What is the easiest way to get "Main ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I want to load and execute external jar file using URLClassLoader. What is the easiest way to get "Main ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    I want to load and execute external jar file using URLClassLoader. What is the easiest way to get "Main ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
...