{"id":872,"date":"2015-05-07T14:48:12","date_gmt":"2015-05-07T14:48:12","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=872"},"modified":"2016-07-04T17:41:57","modified_gmt":"2016-07-04T17:41:57","slug":"creating-and-running-a-jar-file-in-terminal-java","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/creating-and-running-a-jar-file-in-terminal-java\/","title":{"rendered":"Creating and Running a Jar file in Terminal Java"},"content":{"rendered":"<p>1.Compile the Files which should be added.<\/p>\n<pre>\r\njavac Test.java\r\n<\/pre>\n<p>Incase you are working in eclipse the same thing can be seen under the bin directory in the Navigator tab.you need to navigate to the folder to access the class files.<\/p>\n<p>2.Manifest.txt<br \/>\nIncase if you are going to run the jar file the main class which should be called should be added to JAR file as meta-data through META-DATA\/MANIFEST.There should be a <strong>Carriage Return Empty line in Manifest.txt to get read properly<\/strong><\/p>\n<p><em>Manifest.txt<\/em><\/p>\n<pre>\r\nMain-Class: com.mugil.util.Test\r\n\r\n<\/pre>\n<p>3.Create JAR file using the Below command<\/p>\n<pre>\r\njar cfm Test.jar manifest.txt com\/mugil\/util\/*\r\n<\/pre>\n<p>The Above command should be executed from bin directory in our case<\/p>\n<p>* specifies the list of all files in that folder<\/p>\n<p>4.To Run this JAR file <\/p>\n<pre>\r\n java -jar Test.jar\r\n<\/pre>\n<p>When you run the Created Jar file it should be exactly placed in the folder from where the com folder starts.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2016\/07\/JarFileCreation.png\" alt=\"\" width=\"1093\" height=\"614\"\/><\/p>\n<pre>\r\njar cfm Test.jar manifest.txt com\/mugil\/util\/*\r\n<\/pre>\n<p><strong>The letters \u201cm\u201d and \u201cf\u201d must appear in the same order that \u201cmanifest\u201d and \u201cjarfile\u201d appear.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.Compile the Files which should be added. javac Test.java Incase you are working in eclipse the same thing can be seen under the bin directory in the Navigator tab.you need to navigate to the folder to access the class files. 2.Manifest.txt Incase if you are going to run the jar file the main class which&hellip; <a href=\"https:\/\/codethataint.com\/blog\/creating-and-running-a-jar-file-in-terminal-java\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154],"tags":[],"class_list":["post-872","post","type-post","status-publish","format-standard","hentry","category-misc"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=872"}],"version-history":[{"count":6,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/872\/revisions"}],"predecessor-version":[{"id":1353,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/872\/revisions\/1353"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}