Hongseok Yoon
Hongseok Yoon

Reputation: 3318

jar does not generate correct manifest file

I've test simple scala program and compiled it with scalac

object Test {
  def main(args: Array[String]) {
    println("hongseok yoon")
  }
}

If I run that 'java -cp .;scala-library.jar Test' and it works okay. YES, scala-library.jar filee is in same directory.

This is my manifest file manifest.txt

Class-Path: scala-library.jar
Main-Class: Test

and I make jar with 'jar cfm Test.jar manifest.txt *.class'

If I unzip generated Test.jar file and open manifest file, it does not contain Main-Class field. So, It cannot be run with 'java -jar Test.jar'

I can edit it manually and Test.jar runs well.

Why does jar miss Main-Class field? and how to fix this? (If I switch order of fields, only first field is shown)

Upvotes: 3

Views: 1085

Answers (1)

Hongseok Yoon
Hongseok Yoon

Reputation: 3318

ONE more empty line is needed at the end of manifest file. What a stupid restriction! :(

Upvotes: 2

Related Questions