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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:24+00:00 2026-05-26T22:41:24+00:00

I used eclipse to create executable jar. It relies external other jars. In Eclipse,

  • 0

I used eclipse to create executable jar. It relies external other jars.
In Eclipse, It is simple that you just need to choose Extract required libraries into generated JAR.
You can create an executable jar. It can be executed any places where jre is installed.

But If I use command line to compile jar.
javac -classpath [external jars] *.java
jar cfm [a name].jar manifest *.class [external jars]

It can generate jar. But the jar can only be executed in the directory where it is produced.
If I put it into another directory or machine, it complains NoClassDefFoundError.

So, my question is that how I can generate executable jar using command line as Eclipse.

  • 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-26T22:41:25+00:00Added an answer on May 26, 2026 at 10:41 pm

    A jar file cannot have its dependency jars inside. In case of Eclipse, it will unpack all the classes from the dependency jars and will bundle it into your single jar along with your class files. If not in the eclipse way, you need to

    1) Create a manifest file which lists all the dependency jars

    Manifest-Version: 1.0
    Main-Class: Your Main class
    Class-Path: dependency1.jar dependency2.jar dependency3.jar
     dependency4.jar dependency5.jar
    

    2) Create your jar with your class files using the class path including all the dependency jars and using the above created mainfest file.

    3) In this same folder where you created your jar, place all the dependency jars.

    Now your folder will look like this,

    yourjar.jar (With the manifest file you created above)
    dependency1.jar
    dependency2.jar
    dependency3.jar
    dependency4.jar
    dependency5.jar

    4) Now if you want to share this, you need to share this folder and you can launch your jar from this folder. This is your executable folder and you can run it from anywhere.

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

Sidebar

Related Questions

I try to create simple project with JSF, Eclipse and Maven. I used <dependency>
I have recently just created Java project using Eclipse that requires 2 JAR files
I used Eclipse to build a pretty simple Java project. It builds and runs
So I was making a class the other day and used Eclipse's method to
I used to work with eclipse for nearly all the languages I need. I'm
I am looking out for an eclipse plug-in that could be used to detect
i'm using MonoDevelop after used Eclipse for several years. In eclipse when i create
I want to create a plugin that displays additional information about Eclipse's compare results.
i have used eclipse, android sdk and phonegap to create a small application. I
I have installed the m2e plugin for Eclipse and used it to create a

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.