Programming language can be classified as Compiled and interpreted.
1.Compiled (Developed-> Compiled -> Executed): C, C++, Java. Compiled program is first written and then it is compiled for a machine . It works for the specific machine it is designed for.
and
- Interpreted (Developed ->Executed): Node.js, ruby, python. Here the program is developed and then it runs. The basic code is generally encrypted as a bytecode and then it runs.
Basics:
In old days, for Python
This is what compiler used to do:
It would create a machine code which is different for different languages.
Nowadays,
But to solve this issue, there came bytecode .
This bytecode is then interpreted by the python interpreter
The bytecode is then converted into a machine language by the python virtual machine (an environment to run python)
So, as long as the environment exists, it creates a machine language from source code . The machine language is implemented and the code runs.
So, running main.py does all of these in background.
For Java,
you can develop your code once and compile it and then run it everywhere. This makes java cross platform.
Basics of Java
It is a free and open sourced community
ssh app01 to login to app01 server and run below command to download
sudo curl https://download.java.net/java/GA/jdk13.0.2/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-13.0.2_linux-x64_bin.tar.gz --output /opt/openjdk-13.0.2_linux-x64_bin.tar.gz
To uncompress run sudo tar -xf /opt/openjdk-13.0.2_linux-x64_bin.tar.gz -C /opt/
To verify run /opt/jdk-13.0.2/bin/java -version on app01 and confirm correct version is installed.
This is how we are going to install java in this situation.
Done with installing!!!
Here you will need jdk which is actually installed while installing java:
This is what develops, builds and runs your code.
before the version 9 of java, JDK & JRE had to be installed differently. They were not in one single package.
But after that JRE is within the JDK
More about java
Java is compiled like this:
Java code is compiled to a bytecode and then run in a Virtual Machine.
This is how java code is packaged:
using the jar command , we create a output file named Myapp.jar using the contents MyClass.class,Service1.class..........
When this file is created it automatically generates a manifest file within the package at path "META-INF/MANIFEST.MF"
The contains information about the package details.
Once built and compile , java code can be run any where.
For documentation, we use javadoc
It is basically shown in a html version after documentated.
So, in the build process the code is developed, compiled, packaged and documented.
For the complex codes, this can become messy and thus there are some build tools which can be used for Java:
You can specify the build rules or the order to proceed for the build tools:
For example, lets use a build tool ANT:
Generally or manually we would develop, document and package the code:
But using build tool,
This is how we will use XML format :
To develop
To document
Then we run the command
For other build tools like Maven,
That was it for this blog, check the other part from here
Top comments (0)