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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:47:51+00:00 2026-05-17T00:47:51+00:00

I am attempting to create a JAR based on two separate Java packages. I

  • 0

I am attempting to create a JAR based on two separate Java packages. I can compile and run within Eclipse, but cannot get the code to function from the command line. I have Ant and the JDK correctly configured for usage, as I have an almost working Ant build script. The only problem is that the resulting JAR throws a ClassNotFoundException when I attempt to execute it.

The archive contains all the .class files from both packages in the correct directory hierarchy. Regardless, the JAR will throw the above mentioned exception.

The idea is to run this script from the top level directory that contains both packages.

Here are the relevant lines from my build script:

<manifest file="MANIFEST.MF">
    <attribute name="Built-By" value="XBigTK13X"/>
    <attribute name="Main-Class" value="com.main.MainClass"/>
    <attribute name="Class-Path" value="./com/main/ ./secondpackage/shapes/" />
</manifest>
<jar destfile="App.jar"
    basedir="./bin"
    includes="**/*.class"
    manifest="MANIFEST.MF"
    excludes="App.jar"
/>
  • 1 1 Answer
  • 2 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-17T00:47:52+00:00Added an answer on May 17, 2026 at 12:47 am

    The JAR was correct the whole time. This error was thrown because I was attempting to run the JAR with the following command after creating a JAR:

    java MainClass
    

    I now realize that I need to explicitly target the JAR by using the following command:

    java -jar MainClass.jar
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to create a cascading dropdown based on the Knockout.js Cart example but
I am attempting to create some custom map routes but can't get it working
I am attempting to put my Java applet into a .Jar so I can
I attempting to create custom tabs using this . But when I try to
I'm attempting to create a Parcelable class in Android so that I can pass
I am attempting to create a keyboard hook to use in Java. After some
Attempting to create a filter select to find schedules with coursedates within a given
I'm attempting to create a new forum on an existing forum. I can create
I'm attempting to create a small application in which I can make a poul
I am attempting to create a Backbone.js view based on a Twitter bootstrap-modal, which

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.