Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:49:14+00:00 2026-06-07T21:49:14+00:00

I am creating a Java app for some serial port communication and within the

  • 0

I am creating a Java app for some serial port communication and within the app’s folder I have two resources that need to be present at run-time. The first is an image that is being used as a splash screen and the other is a configuration file that needs to be read as the program starts.

Here is an abridged version of the output from the “tree” command in Linux, the two files that I need to be referencing are “commandSet.config” and “splash-screen2.png”

.
├── bin
│   ├──...
├── commandSet.config
├── app-manifest.txt
├── splash-screen2.png
└── src
    ├── events
    │   └── InterfaceEvents.java
    ├── models
    │   ├── Command.java
    │   └── Phone.java
    ├── operations
    │   ├── Application.java
    │   ├── ...
    └── views
        ├── CallDialog.java
        ├── SplashScreen.java
        └── Window.java

I am currently referencing in the following lines:

BufferedReader in = new BufferedReader(new FileReader("commandSet.config"));

and

JLabel image = new JLabel(new ImageIcon("splash-screen2.png"));

This works fine when I am running it from Eclipse, but as soon as I export to a runnable JAR the files are not moved and therefore aren’t correctly referenced. I have tried moving them into the “src” folder, which resulted in them being archived within the JAR, but I still couldn’t reference them.

I’m pretty new to the concept of exporting Java projects, so maybe I have missed something obvious. If someone could show me the best way to do this and the best approach for future project file systems, I would be very grateful. Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:49:17+00:00Added an answer on June 7, 2026 at 9:49 pm

    Ok, I mananged to crack this and thought I’d drop an answer for others in the future. I basically followed “duffymo’s” guidelines, here’s what I did:

    • Created a JAR with my resources in.
    • Put that JAR in the root of the project.
    • Used Eclipse to add that JAR to the build path.
    • Used getResourceAsStream(“/nameOfFile.ext“) to get the streams for my resources.

    Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java web app that offloads some environment specific settings (Hibernate configurations,
I am creating a Java web app that is meant for use by Facebook
I've creating a Java Swing application and I realized that I have many many
I am creating a app in Java. I need to provide additional behavior when
I am creating a desktop app that will create some reports. I want to
I am creating a java app. I have one class q2a2 which is a
I'm creating my first android app that will make use of SQlite. I have
I have written some code in Java that will decode a SHOUTcast stream and
I have a java app that creates a socket to talk to a server
I'm creating a java Swing app and I'm new to that. The problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.