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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:29:37+00:00 2026-06-05T10:29:37+00:00

I have an external library(just one class file called org.vinay.dep.DependedClass).It is well within its

  • 0

I have an external library(just one class file called org.vinay.dep.DependedClass).It is well within
its package directory structure and directory org is on Desktop.

And I have a jar called a.jar which has dependency on my external lib.

Executing jar -tf a.jar gives below output,

META-INF/                
META-INF/MANIFEST.MF     
com/      
com/os/          
com/os/hw/          
com/os/hw/HelloWorld.class       
com/os/hw/HwUtil.class 

I tried to run the jar in 2 ways

  1. java -classpath C:/Users/vinay/Desktop -jar a.jar with
    manifest.mf entries being

    Manifest-Version: 1.0
    Created-By: 1.6.0_05 (Sun
    Microsystems Inc.)
    Main-Class: com.os.hw.HelloWorld

    and got NoClassDefFoundError for DependedClass

  2. java -jar a.jar after changing manifest entries as below

    Manifest-Version: 1.0
    Created-By: 1.6.0_05 (Sun
    Microsystems Inc.)
    Main-Class: com.os.hw.HelloWorld
    Class-Path: C:/Users/vinay/Desktop

    But this time it throwed NoClassDefFoundError for HelloWorld
    class itself

When i package my external lib into jar and use the jar name for Class-Path entry in manifest file it works.Is there a way to resolve this problem without packaging external lib into 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-06-05T10:29:38+00:00Added an answer on June 5, 2026 at 10:29 am

    I don’t think you can combine -classpath and -jar. You can instead do it like this:

    java -cp C:/Users/vinay/Desktop;a.jar com.os.hw.HelloWorld
    

    This assumes a.jar is in the current folder (or you can add full path to a.jar as well).

    Hardcoding the Class-Path entry of your manifest to a path on your local machine is never the correct solution 🙂

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

Sidebar

Related Questions

I have a problem; I'm using an external library where one particular event has
I have an external javascript library which triggers on the change of a textarea,
In my program, I have a string (obtained from an external library) which doesn't
I have a library that does I/O. There are a couple of external knobs
I have an external setting file which has some nodes holiding attribute values of
I have an external Javascript file and i am trying to alert the value
I'm trying to use an external library (wingraph) in a simple program. I have
I have a WPF application and I use external library for generating documents. This
I have one xml file which i want to store it in a internal
I have a library that interfaces with an external tool and exposes some basic

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.