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

  • Home
  • SEARCH
  • 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 7918035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:22:07+00:00 2026-06-03T15:22:07+00:00

I used the instructions found at Maven – how can I add an arbitrary

  • 0

I used the instructions found at Maven – how can I add an arbitrary classpath entry to a jar to add an arbitrary entry to the Class-Path attribute. Here is my MANIFEST.MF file:

Manifest-Version: 1.0
Class-Path: jace-runtime.jar
Main-Class: org.jace.examples.Test

I defined org.jace.examples.Test as follows:

public class Test
{
    public static void main(String[] args)
    {
        System.out.println("classpath: " + System.getProperty("java.class.path"));
        System.out.println("PeerExample: " + Class.forName("org.jace.util.ShutdownHook"));
    }
}

where org.jace.util.ShutdownHook is defined in jace-runtime.jar. When I invoke java -jar peer_example1.jar I get the following output:

classpath: peer_example1.jar
Exception in thread “main” java.lang.ClassNotFoundException: org.jace.util.ShutdownHook

In other words, Java is adding the executable JAR file to the classpath but ignoring Class-Path. If I invoke java -cp jace-runtime.jar;peer_example1.jar org.jace.examples.Test I get the expected output:

classpath: jace-runtime.jar;peer_example1.jar

Any ideas?

  • 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-03T15:22:09+00:00Added an answer on June 3, 2026 at 3:22 pm

    Answering my own question:

    1. Adding arbitrary entries to Class-Path is fine on its own. The problem arises when you enable JAR indexing using:

      <configuration>
        <archive>
          <index>true</index>
        </archive>
      </configuration>
      

      Maven will omit your entries from META-INF/INDEX.LIST.

    2. When you use the JAR at runtime, Java will look at INDEX.LIST for finding classes, not MANIFEST.MF.

    3. Because your entries are missing from INDEX.LIST, they will not be found by the classloader, no matter what the manifest says.

    A simple workaround is to disable JAR indexing. I’m not sure how to inject an arbitrary Class-Path with indexing enabled.

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

Sidebar

Related Questions

I'm building OpenLDAP on a RHEL 5; I used instructions found at http://www.linux.com/archive/feature/113607 .
I was told that running programs generate probability data used to optimize repeated instructions.
Used code I found on SO to use the COM based Acrobat Reader to
There used to be an option in the submit wizard where you can specify
I used the xsd.exe tool to generate a class based on my xml schema.
Hi I'm trying to use the CakePHP comments plugin found here http://cakedc.com/downloads/view/cakephp_comments_plugin but the
I am trying to add a local maven repository that I have set up
I am following the instructions here for cross-compiling GCC. I am on a mac.
Used to be quite happy with the Ctrl + Shift + F10 shortcut in
I used a tool a few months ago that scanned a specified website and

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.