java - how to create jar file? -


i trying create jar file .java program

followed steps

step 1. create 'mywork' folder step 2: put xyz.java , gson.jar file under mywork folder step 3. use javac -cp .:gson.jar xyz.class step 4. create jar file -> jar cf xyz.jar xyz.class step 5. create manifest.txt , modify include mainclass:xyz step 6. modify manifest.txt include classpath gson.jar step 7. run command-> jar cfm xyz.jar manifest.txt xyz.class argument1 argument2 

when doing step 7 getting

"java.io.ioexception: invalid header field" error 

where going wrong, please me solve problem.

my manifest.txt like

manifest-version: 1.0 class-path:gson.jar created-by: 1.7.0_06 (oracle corporation) main-class: xyz 

main method:

public static void main(string[] args) throws exception {      // enter values arguments     string dirstr = args[0];     string logfiledirstr =  args[1];          xyz data = new xyz();         data.method1(dirstr,logfiledirstr); } 

you need prefix value space after semicolon

change

class-path:gson.jar 

to

class-path: gson.jar 

viz http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#name-value_pairs_and_sections

value:space *otherchar newline *continuation


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -