{"id":1313,"date":"2016-09-06T07:26:55","date_gmt":"2016-09-06T07:26:55","guid":{"rendered":"http:\/\/www.testingdocs.com\/questions\/?p=1313"},"modified":"2024-12-14T03:36:56","modified_gmt":"2024-12-14T03:36:56","slug":"how-to-compile-and-run-java-program-without-ide","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/how-to-compile-and-run-java-program-without-ide\/","title":{"rendered":"How to compile and run Java program without IDE?"},"content":{"rendered":"<h2>How to compile and run Java program without IDE?<\/h2>\n<p>In this tutorial, we will learn the steps involved to compile and run the Java program without IDE. Detailed steps are shown below:<\/p>\n<h3><strong>Steps<\/strong><\/h3>\n<p>To compile and run Java program we require an editor( ex Notepad, TextPad etc ), java compiler (<strong> javac<\/strong> ) and java.<\/p>\n<p>We can create and edit a java program in Notepad editor and save it as a file with the <strong>.java<\/strong> extension.<\/p>\n<p>Create a file ( Example.java ) with the help of text editor. You can choose your favorite editor like Notepad , TextPad etc.The filename should be the class name.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-534\" src=\"http:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Example-java-program-compile-command-line.jpeg\" alt=\"example java program\" width=\"1211\" height=\"755\" title=\"\"><\/p>\n<p>Type in the below sample program and save the file.<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class Example {\r\npublic static void main(String args[]) {\r\nSystem.out.println(\"This is an example class\"); }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Open Command prompt and cd to the path of the file.<\/p>\n<p>Compile the java file, with command line ( <strong>\/&gt; javac Example.java<\/strong> )<\/p>\n<p>The output of the compilation would yield the .class file. ( Example.class )<\/p>\n<h3><strong>Run the program<\/strong><\/h3>\n<p>In next step, we can execute the class file with java command as shown in the picture. ( <strong>\/&gt; java Example<\/strong> )<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-533\" src=\"http:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Compile-and-Run-Java-Program-Command-line.jpeg\" alt=\"compile\" width=\"1351\" height=\"619\" title=\"\"><br \/>\nPlease note that when we execute the class file, we do not require the .<strong>class<\/strong> extension as shown in the above command.<\/p>\n<p>In case, you are beginner learning java automation, We suggest you to learn Java coding a few Java programs without IDE. However, there are lot of benefits of Integrated development approach. IDEs provide the comfort of assisting you as you edit the code, with all possible methods and syntax.<\/p>\n<p>&nbsp;<\/p>\n<p>Java Tutorial on this website:<\/p>\n<p><strong><a href=\"https:\/\/www.testingdocs.com\/java-tutorial\/\">https:\/\/www.testingdocs.com\/java-tutorial\/<\/a><\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to compile and run Java program without IDE? In this tutorial, we will learn the steps involved to compile and run the Java program without IDE. Detailed steps are shown below: Steps To compile and run Java program we require an editor( ex Notepad, TextPad etc ), java compiler ( javac ) and java. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1313","post","type-post","status-publish","format-standard","hentry","category-java-programs","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":12,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":26344,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/1313\/revisions\/26344"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}