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 152827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:41:34+00:00 2026-05-11T09:41:34+00:00

In my application I load resources in this manner: WinProcessor.class.getResource(repository).toString(); and this gives me:

  • 0

In my application I load resources in this manner:

WinProcessor.class.getResource('repository').toString(); 

and this gives me:

file:/root/app/repository   (and I replace 'file:' with empty string) 

This works fine when I run my application from the IDE, but when I run the jar of my application:

java -jar app.jar 

The path becomes:

jar:/root/app.jar!/repository 

is there any way to solve this problem?

I’ll use the ‘repository’ dir name in order to create this:

ConfigurationContext ctx = (ConfigurationContext) ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryString, null); 

In the same manner, I’ll get one file name (instead of a dir) and I’ll use it this way:

System.setProperty('javax.net.ssl.trustStore', fileNameString) 
  • 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. 2026-05-11T09:41:35+00:00Added an answer on May 11, 2026 at 9:41 am

    It sounds like you’re then trying to load the resource using a FileInputStream or something like that. Don’t do that: instead of calling getResource, call getResourceAsStream and read the data from that.

    (You could load the resources from the URL instead, but calling getResourceAsStream is a bit more convenient.)

    EDIT: Having seen your updated answer, it seems other bits of code rely on the data being in a physical single file in the file system. The answer is therefore not to bundle it in a jar file in the first place. You could check whether it’s in a separate file, and if not extract it to a temporary file, but that’s pretty hacky IMO.

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

Sidebar

Related Questions

Some times the Facebook resources are not load for eg.all.js file that collapse my
Get the following error periodically in an IIS application: Failed to load resources from
Following best practices, I'm using Thread.currentThread().getContextClassLoader().getResourceAsStream to load resources in a web application (like
Following this blog article I enabled my application to load i18n messages from the
I have couple resource DLLs that I currently load when application starts using following
I need to have a Win32 application load a hard coded AES-256 key, ideally
My application should load some data when it start at first time, but it
In my application I load information from several (6-10) websites using NSXMLParser and then
I have the following code in my application to load some data from my
In our application (c++) we load 3rd party DLLs using LoadLibrary. Sometimes these DLLs

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.