manifest - Create jar file that can be executed on any machine -


I have a simple Java app that prints 'Hello World'! On console it is packed in app.jar: Jar Structure:

Main / Hello. Class - Singing printline method with my main category

Meta-INF / MANIFEST.MF

The following are the manifest files:

  Manifest-version: 1.0 Main-Class: Main.Holo  

Everything goes fine.

But when you have reliance on troubles, I am not sure, but in this case think that you have to keep all the lbs in a jar file. If I put them in Meta-INF / lib, then I'll have to specify a "class-path" in the manifest. How will "class-path" look?

PS has some similar questions but I have not received the correct answer.

I use the ANt build script to package my app and all the required jar files < / P>

The build.xml file looks something like this:

  & lt; Project default = "create_run_jar" name = "Create Runnable Jar for MyProject" & gt; & Lt ;! - Requires ANT 1.7 - & gt; & Lt; Target name = "create_run_jar"> & Lt; Jar destfile = "my-runnable-jar.jar" & gt; & Lt; Appearance & gt; & Lt; Attribute name = "main category" value = "my.mainClass" /> & Lt; Attribute name = "Class-path" value = "." / & Gt; & Lt; / Reveal & gt; & Lt; Fileset dir = "E: / path / to / my / project / bin" / & gt; & Lt; Fileset dir = "E: / path / to / my / project / classes" / & gt; & Lt; Zipfileset src = "E: /path/to/library/some-library.jar" /> & Lt; / Jar & gt; & Lt; / Target & gt; & Lt; / Project & gt;  

Note that if you use Eclipse, you can do file / export ... / runable jar file simply and it will do everything for you (ANT Build . With the creation of XML). / P>


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -