Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the meta-box domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php on line 6114

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/bhtinstitute/public_html/knowhow/wp-includes/functions.php:6114) in /home2/bhtinstitute/public_html/knowhow/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":181,"date":"2020-12-04T17:42:18","date_gmt":"2020-12-04T17:42:18","guid":{"rendered":"http:\/\/bhtinstitute.com\/knowhow\/?p=181"},"modified":"2020-12-04T17:42:33","modified_gmt":"2020-12-04T17:42:33","slug":"ii-get-started-with-java-programming","status":"publish","type":"post","link":"https:\/\/bhtinstitute.com\/knowhow\/?p=181","title":{"rendered":"II – Get Started with Java Programming"},"content":{"rendered":"\n

1.  How To Install JDK on Windows<\/h3>\n\n\n\n

Step 0: Un-Install Older Version(s) of JDK\/JRE<\/h5>\n\n\n\n

I recommend that you install only the latest<\/em> JDK. Although you can install multiple versions of JDK\/JRE concurrently, it is messy.<\/p>\n\n\n\n

If you have previously installed older version(s) of JDK\/JRE, un-install ALL of them. Goto “Control Panel” \u21d2 (optional) “Programs” \u21d2 “Programs and Features” \u21d2 Un-install ALL programs begin with “Java”, such as “Java SE Development Kit …”, “Java SE Runtime …”, “Java X Update …”, and etc.<\/p>\n\n\n\n

Step 1: Download JDK<\/h5>\n\n\n\n
  1. Goto Java SE download site @ http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/index.html<\/a>.<\/li>
  2. Under “Java Platform, Standard Edition” \u21d2 “Java SE 13.0.{x}”, where {x} denotes a fast running security-update number \u21d2 Click the “Oracle JDK Download” button.<\/li>
  3. Under “Java SE Development Kit 13.0.{x}” \u21d2 Check “Accept License Agreement”.<\/li>
  4. Choose the JDK for your operating system, i.e., “Windows”. Download the “exe<\/strong>” installer (e.g., “jdk-13.0.{x}_windows-x64_bin.exe<\/strong><\/code>” – about 159MB).<\/li><\/ol>\n\n\n\n
    Step 2: Install JDK<\/h5>\n\n\n\n

    Run the downloaded installer (e.g., “jdk-13.0.{x}_windows-x64_bin.exe<\/code>“), which installs both the JDK and JRE.<\/p>\n\n\n\n

    By default, JDK is installed in directory “C:\\Program Files\\Java\\jdk-13.0.{x}<\/code>“, where {x}<\/code> denotes the update number. Accept the defaults and follow the screen instructions to install JDK.<\/p>\n\n\n\n

    Use your “File Explorer”, navigate to \"C:\\Program Files\\Java\"<\/code> to inspect the sub-directories. Take note of your JDK installed directory<\/strong> jdk-13.0.{x}<\/code>, in particular, the update number {x}<\/code>, which you will need in the next step.<\/p>\n\n\n\n

    I shall refer to the JDK installed directory<\/strong> as <JAVA_HOME><\/code><\/strong>, hereafter, in this article.<\/p>\n\n\n\n

    Step 3: Include JDK’s “bin” Directory in the PATH<\/h5>\n\n\n\n

    Windows’ Command Prompt (CMD<\/code>) searches the current directory and the directories listed in the PATH<\/code> environment variable<\/em> (or system variable<\/em>) for executable programs. JDK’s programs (such as Java compiler \"javac.exe<\/code>” and Java runtime \"java.exe<\/code>“) reside in the sub-directory<\/em> “bin<\/code>” of the JDK installed directory. You need to include JDK’s “bin<\/code>” in the PATH<\/code> to run the JDK programs.<\/p>\n\n\n\n

    To edit the PATH<\/code> environment variable in Windows 10:<\/p>\n\n\n\n

    1. Launch “Control Panel” \u21d2 (Optional) “System and Security” \u21d2 “System” \u21d2 Click “Advanced system settings” on the left pane.<\/li>
    2. Switch to “Advanced” tab \u21d2 Click “Environment Variables” button.<\/li>
    3. Under “System Variables” (the bottom pane), scroll down to select variable “Path” \u21d2 Click “Edit…”.<\/li>
    4. For Newer Windows 10<\/strong>:
      You shall see a TABLE<\/strong> listing all the existing PATH entries (if not, goto next step). Click “New” \u21d2 Click “Browse” and navigate to your JDK’s “bin<\/code>” directory, i.e., “c:\\Program Files\\Java\\jdk-13.0.{x}\\bin<\/strong><\/code>“, where {x}<\/code> is your installation update number \u21d2 Select “Move Up” to move this entry all the way to the TOP.<\/li>
    5. For Older Windows 10<\/strong> (Time to change your computer!):
      (CAUTION: Read this paragraph 3 times before doing this step! Don’t push “Apply” or “OK” until you are 101% sure. There is no UNDO!!!)<\/strong>
      (To be SAFE, copy the content of the “Variable value” to Notepad before changing it!!!)
      In “Variable value” field, APPEND “c:\\Program Files\\Java\\jdk-13.0.{x}\\bin<\/code>” (where {x}<\/code> is your installation update number) IN FRONT of all the existing directories, followed by a semi-colon (;<\/code>) to separate the JDK’s bin directory from the rest of the existing directories. DO NOT DELETE any existing entries; otherwise, some existing applications may not run.Variable name : PATH<\/strong> Variable value : c:\\Program Files\\Java\\jdk-13.0.{x}\\bin;<\/strong>[do not delete exiting entries…<\/em>]<\/strong><\/li><\/ol>\n\n\n\n

      Note: If you have started CMD, you need to re-start for the new environment settings to take effect.<\/p>\n\n\n\n

      Step 4: Verify the JDK Installation<\/h5>\n\n\n\n

      Launch a CMD<\/code> via one of the following means:<\/p>\n\n\n\n

      1. Click “Search” button \u21d2 Type “cmd” \u21d2 Choose “Command Prompt”, or<\/li>
      2. Right-click “Start” button \u21d2 run… \u21d2 enter “cmd”, or<\/li>
      3. Click “Start” button \u21d2 Windows System \u21d2 Command Prompt<\/li><\/ol>\n\n\n\n

        Issue the following commands to verify your JDK installation:<\/p>\n\n\n\n

        1. Issue “path<\/code>” command to list the contents of the PATH<\/code> environment variable. Check to make sure that your JDK’s “bin<\/code>” is listed in the PATH<\/code>.path<\/strong> PATH=c:\\Program Files\\Java\\jdk-13.0.{x}\\bin;other entries…<\/li>
        2. Issue the following commands to verify that JDK\/JRE are properly installed and display their version:\/\/ Display the JDK version javac -version<\/strong> javac 13.0.1 \/\/ Display the JRE version java -version<\/strong> java version “13.0.1” 2019-10-15 Java(TM) SE Runtime Environment (build 13.0.1+9) Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)<\/li><\/ol>\n\n\n\n
          Step 5: Write a Hello-World Java Program<\/h5>\n\n\n\n
          1. Create a directory to keep your works, e.g., “d:\\myProject<\/code>” or “c:\\myProject<\/code>“. Do NOT save your works in “Desktop” or “Documents” as they are hard to locate. The directory name shall not contain blank<\/em> or special characters. Use meaningful but short name as it is easier to type.<\/li>
          2. Launch a programming text editor (such as TextPad<\/a>, NotePad++<\/a>, Sublime Text, Atom). Begin with a new file<\/em> and enter the following source code. Save the file as “Hello.java<\/code>“, under your work directory (e.g., d:\\myProject<\/code>).\/* * First Java program to say Hello *\/ public class Hello { \/\/ Save as “Hello.java” under “d:\\myProject” public static void main(String[] args) { System.out.println(“Hello, world!”); } }<\/li><\/ol>\n\n\n\n
            Step 6: Compile and Run the Hello-World Java Program<\/h5>\n\n\n\n
            \"JavaBasics_GettingStarted.png\"<\/figure>\n\n\n\n

            To compile the source code “Hello.java<\/code>“:<\/p>\n\n\n\n

            1. Start a CMD Shell (Search \u21d2 enter “cmd” \u21d2 select “Command Prompt”).<\/li>
            2. Set the Current Drive<\/em> to the drive where you saved your source file “Hello.java<\/code>“.
              If you use drive “c”, skip this step.
              Else if you use drive “d<\/code>“, enter “d:<\/strong><\/code>” as follow:d:<\/strong> D:\\xxx><\/li>
            3. Set the Current Working Directory<\/em> to the directory that you saved your source file via the cd<\/code><\/strong> (Change Directory<\/em>) command. For example, suppose that your source file is saved in directory “myProject<\/code>“.
              cd \\myProject<\/strong> D:\\myProject><\/li>
            4. Issue a dir<\/code><\/strong> (List Directory<\/em>) command to confirm that your source file is present in the current directory<\/em>.dir<\/strong> …… xx-xxx-xx xx:xx PM 277 Hello.java<\/strong> ……<\/li>
            5. Invoke the JDK compiler “javac<\/code><\/strong>” to compile the source code “Hello.java<\/code>“.javac Hello.java<\/strong> \/\/ If error message appears, correct your source code and re-compileThe compilation is successful if the command prompt returns. Otherwise, error messages would be shown. Correct the errors in your source file and re-compile. Check “Common JDK Installation Errors<\/a>“, if you encounter problem compiling your program.<\/li>
            6. The output of the compilation is a Java class called “Hello.class<\/code>“. Issue a dir<\/code><\/strong> (List Directory<\/em>) command again to check for the output.dir<\/strong> …… xx-xxx-xx xx:xx PM 416 Hello.class<\/strong> xx-xxx-xx xx:xx PM 277 Hello.java ……<\/li><\/ol>\n\n\n\n

              To run the program, invoke the Java Runtime “java<\/strong><\/code>“:<\/p>\n\n\n\n

              java Hello<\/strong>\nHello, world!<\/pre>\n\n\n\n

              Everything that can possibly go wrong will go wrong<\/strong>: Read “JDK Installation Common Errors<\/a>“.<\/p>\n\n\n\n

              Step 7: (For Advanced Users Only) JDK’s Source Code<\/h5>\n\n\n\n

              Source code for JDK is provided and kept in “<JAVA_HOME>\\lib\\src.zip<\/code>” (or “<JAVA_HOME>\\src.zip<\/code>” prior to JDK 9). I strongly recommend that you to go through some of the source files such as “String.java<\/code>“, “Math.java<\/code>“, and “Integer.java<\/code>“, under “java\\lang<\/code>“, to learn how experts program.<\/p>\n","protected":false},"excerpt":{"rendered":"

              1.  How To Install JDK on Windows Step 0: Un-Install Older Version(s) of JDK\/JRE I recommend that you install only the latest JDK. Although you can install multiple versions of JDK\/JRE concurrently, it is messy. If you have previously installed older version(s) of JDK\/JRE, un-install ALL of them. Goto “Control Panel” \u21d2 (optional) “Programs” \u21d2 “Programs and Features” […]<\/p>\n","protected":false},"author":1,"featured_media":183,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17],"tags":[],"class_list":["post-181","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/bhtinstitute.com\/knowhow\/wp-content\/uploads\/2020\/12\/javalogo.png","_links":{"self":[{"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/posts\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=181"}],"version-history":[{"count":1,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/posts\/181\/revisions\/184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=\/wp\/v2\/media\/183"}],"wp:attachment":[{"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bhtinstitute.com\/knowhow\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}