1

My file structure looks like this:

manifest
CP.java
folder/
    X.java

CP is a class which simply prints out System.getProperty("java.class.path").

manifest is:

Main-Class: CP
Class-Path: folder

I make a jar with:

$ jar cvfm x.jar manifest CP.class

Now, the problem is shown:

$ java -jar x.jar
x.jar

How can I make the output

x.jar:folder

?

Aaron Yodaiken
  • 19,163
  • 32
  • 103
  • 184

1 Answers1

0

The Class-Path header is intended to load classes from other jars from within your jar file.

Class-Path: jar1-name jar2-name directory-name/jar3-name 

I think your "folder" manifest addition is just dropped because it doesn't conform with specifications (jar tutorial).

guido
  • 18,864
  • 6
  • 70
  • 95
  • How can I get my desired result then? `java -cp` doesn't work on jars. – Aaron Yodaiken Jan 29 '12 at 03:19
  • What exactly is your desired result? Could you just include X.class in the CP.class jar, or create another jar with X.class and load that in your manifest? – guido Jan 29 '12 at 03:27