<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: thatanonymousgirl</title>
    <description>The latest articles on Forem by thatanonymousgirl (@thatanonymousgirl).</description>
    <link>https://forem.com/thatanonymousgirl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F460138%2F1548e483-1dfa-416e-96d2-49067b14c488.png</url>
      <title>Forem: thatanonymousgirl</title>
      <link>https://forem.com/thatanonymousgirl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/thatanonymousgirl"/>
    <language>en</language>
    <item>
      <title>Problems with running java programs using CLR</title>
      <dc:creator>thatanonymousgirl</dc:creator>
      <pubDate>Mon, 10 May 2021 05:29:13 +0000</pubDate>
      <link>https://forem.com/thatanonymousgirl/problems-with-running-java-programs-using-clr-c06</link>
      <guid>https://forem.com/thatanonymousgirl/problems-with-running-java-programs-using-clr-c06</guid>
      <description>&lt;p&gt;Starting with Java? &lt;/p&gt;

&lt;p&gt;Well, the first step as a newbie would be to install JDK - Java Development Kit. In earlier versions of JDK, there used to be a private JRE (Java Runtime Environment) as well as a public JRE as well. In later versions, the structure is changed, and we get only one folder of JDK, with private JRE. No Public JRE.&lt;br&gt;
With the latest JDK version 16 in the market, one should still always go for the version which provides LTS - Long Time Support.&lt;br&gt;
Currently, one should opt for Java SE 11 (LTS). &lt;/p&gt;

&lt;p&gt;Now, Before running a program from the command line in java, things to be taken care of:&lt;/p&gt;

&lt;p&gt;A.  Set PATH variable in environment variables. It will tell the OS where the java executables like javac, java.exe are located. Set it to point &lt;code&gt;JDK version/bin&lt;/code&gt; folder&lt;/p&gt;

&lt;p&gt;B.  Then, check if the classpath is set already?&lt;br&gt;
Classpath will tell the java interpreter where to find java &lt;em&gt;class file&lt;/em&gt; to run.&lt;br&gt;
If it is not, leave it as it is. If it is already set to some value, make sure you add, current directory in that as well. Denote current directory by  &lt;code&gt;.;&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;C.  To run a program from the command line, go to the &lt;em&gt;source root folder&lt;/em&gt; and then run the execute java command along with a fully qualified package name. i.e., java com.rajnesh.MainClass&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Like below:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DGgM5wk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/40xbonphbw6k8m7yfxs2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DGgM5wk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/40xbonphbw6k8m7yfxs2.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Running it from anywhere else would throw this exception:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nx5i8zTG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vhqw3d3gldss6y6qy94.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nx5i8zTG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vhqw3d3gldss6y6qy94.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>computerscience</category>
      <category>codenewbie</category>
      <category>career</category>
    </item>
    <item>
      <title>How Java program actually runs? What is Just in time compiler?</title>
      <dc:creator>thatanonymousgirl</dc:creator>
      <pubDate>Sun, 04 Oct 2020 12:05:47 +0000</pubDate>
      <link>https://forem.com/thatanonymousgirl/how-java-program-actually-runs-what-is-just-in-time-compiler-pg5</link>
      <guid>https://forem.com/thatanonymousgirl/how-java-program-actually-runs-what-is-just-in-time-compiler-pg5</guid>
      <description>&lt;p&gt;Java is a bit different from other types of compiled and interpreted languages.&lt;br&gt;
First, a java program is compiled from source code to intermediate code called the byte code.&lt;br&gt;
Java compiler does this job and javac command is used to invoke it.&lt;/p&gt;

&lt;p&gt;This byte code is portable and can be run on any machine that has a machine specific JVM &lt;br&gt;
installed on it. Now, JVM when triggered using the java command, will take line by line of this byte code and interpret it to machine code.&lt;br&gt;
Here JIT comes into the picture. Even though it can optionally be disabled, it is a very useful part of JRE.&lt;/p&gt;

&lt;p&gt;When JVM is invoked by the java command, the first thing it does is load the .class files at runtime &lt;br&gt;
and then convert them into machine understandable code using an interpreter.&lt;br&gt;
JIT Compiler when enabled, makes JVM analyze method calls in byte code, and if it sees any repeated code,&lt;br&gt;
JIT compiles it to machine code the first time and replaces all the other occurrences directly with the machine code, hence saving a good amount of time.&lt;/p&gt;

</description>
      <category>java</category>
      <category>devops</category>
      <category>codenewbie</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
