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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:00:18+00:00 2026-05-25T20:00:18+00:00

I am creating an executable jar with maven and have added the following to

  • 0

I am creating an executable jar with maven and have added the following to my pom.xml under build section

<build>
.....
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/snmp</directory>
                             <includes>
                                 <include>**/*</include>
                             </includes>
            </resource>
        </resources>
.....
</build>

And I use the maven-shade-plugin to build jar with dependencies.

When I run the command after the build

java -jar jarName

It does not unzip all the files under src/main/snmp directory, for some reason it always unzips one file (the same file) every time. But if I do

jar -xf jarName

this unzips everything correctly.

Any other thing that I need to for using resources from a executable jar?

  • 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-05-25T20:00:19+00:00Added an answer on May 25, 2026 at 8:00 pm

    Java -jar isn’t supposed to extract anything, it’s supposed to run whatever main method you’ve declared in your manifest.

    What do you mean by “use resources from an executable jar”? If you mean access resources on the classpath from within the application, if you’re doing it right, it should work fine-but there’s no extraction.

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

Sidebar

Related Questions

I am creating an executable jar using the jar-with-dependencies component of the maven-assembly-plugin during
I’m creating an executable JAR that will read in a set of properties at
Imagine you have an executable foo.rb, with libraries bar.rb layed out in the following
I'm using the Maven 2 assembly plug-in to build a jar-with-dependencies and make an
I'm creating a COM server executable, and have run into a problem with class
I have created an executable JAR with the manifest: Manifest-Version: 1.0 Main-Class: MyClass Class-Path:
I have a Java application that I want to turn into an executable jar.
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
When creating a web application, and lets say you have a User object denoting
I'm trying to make an executable war file ( java -jar myWarFile.war ) that

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.