• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help on Creating a Jar file for my JavaBean  RSS feed

 
femi lami
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a package called voiceexpert which contains three classes: Disease, DiagnosingEngine and Symptoms which is a JavaBean. Symptoms makes use of Disease and DiagnosingEngine objects.

voiceexpert is stored in the directory: c:\diagapp3

I compiled Symptoms.java as below:
c:\diagapp3> javac -d . Symptoms.java

The class files for Disease.java, DiagnosingEngine.java and Symptoms.java are placed in the directory: voiceexpert.

I created a Manifest.txt file inside c:\diagapp3 containing the following:

Main-Class:voiceexpert.voiceexpert.Symptoms

Name:voiceexpert/Symptoms.class

Java-Bean:True

I later created the jar file with the command:

jar cfm jjj.jar Manifest.txt *

But, I am having the error message: invalid header field

What can I do to remove this error?

Note: I created the Manifest.txt using utf-8 encoding. My code is to be used in a third-party application and that is why it does not contain a main method.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be a space after the colon
e.g. Main-Class:voiceexpert.voiceexpert.Symptoms should be Main-Class: voiceexpert.voiceexpert.Symptoms
Also your manifest file should end in a new line or carriage return.

 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another one is I think you should not have new line between the property in manifest file.

For more details see Manifest

 
femi lami
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried what you advised but still having the same problems.
Could you please explain what the following mean and how to actually follow these guidelines to jar my files?

section: *header +newline
nonempty-section: +header +newline
newline: CR LF | LF | CR (not followed by LF)
header: name : value
name: alphanum *headerchar
value: SPACE *otherchar newline *continuation
continuation: SPACE *otherchar newline
alphanum: {A-Z} | {a-z} | {0-9}
headerchar: alphanum | - | _
otherchar: any UTF-8 character except NUL, CR and LF
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
femi lami wrote:My code is to be used in a third-party application and that is why it does not contain a main method.


I don't think this is the cause of the error, but if your code doesn't contain a main method then you don't need a Main-Class entry in your jar file.
 
femi lami
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed the Main-Class header, yet the same error still persisted.
What do you think I can do to get over this problem?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Impossible to tell without more details.
Post the exact (copy paste) contents of your manifest file.
 
femi lami
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The contents of the Manifest file I created is:

Manifest-Version: 1.0

Created-By: 1.6.0 (Sun Microsystems Inc.)

Name: voiceexpert/Symptoms.class

Java-Bean: True

This gave the error mesage: invalid header field name: Manifest-Version
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!