#4 How Java Works
Вставка
- Опубліковано 17 жов 2024
- Check out our courses:
Spring Boot and Microservices Live Course : go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Complete Java Developer Course Batch-3: go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Enterprise Java Spring Microservices: go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com...
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Spring: go.telusko.com...
Java:- go.telusko.com...
Java Spring:- go.telusko.com...
Java For Programmers:- go.telusko.com...
Python : go.telusko.com...
Git : go.telusko.com...
Docker : go.telusko.com...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusk...
n this lecture we will learn:
Steps to execute the Java code
What is Byte Code?
Java is a platform-independent language
Execution always starts from the main method
Object-oriented language
What are JRE and JDK?
#1
Steps to run the Java Code:-
We required JVM to run a java code.
The job of the JVM is to execute the java code that you have created but it does not accept the code directly.
JVM does not accept the Java code as it only understands the Byte Code.
Java compiler also known as javac is used to convert java code into byte code.
The extension for the byte code is .class
Thus, the code written by the programmer is first converted into byte code by the compiler and then that byte code goes to the JVM for further execution.
Programmer- Java Code- Compiler- Byte Code- JVM
#2
Java is a platform-independent language:-
It means you can run Java on any machine irrespective of any hardware or operating system.
The one thing that the machine requires to run a java code is a JVM.
:- JVM is platform dependent and it needs to be built for a particular OS.
#3
In Java, execution always starts from the main method:-
JVM starts execution only with one first file. If you need to run multiple files you need to tell it which one is the first file through which JVM can start execution.
The first file must contain the main method with its proper signature.
In Java, execution always starts from the main method.
Signature of main method:
public static void main(String args[])
#4
Java is an object-oriented language:-
Object-oriented means everything should be an object.
We always required a class to create an object.
#5
JRE:-
To run the Java application, you need extra libraries and need runtime. Runtime is something where you run things.
You use extra libraries, and you also need an environment. An additional layer is present above the OS known as JRE.
JVM is a part of JRE. JRE includes JVM and libraries.
JVM - Java Virutal Machine
JRE - Java Runtime Environment
For development purposes, you need to install JDK (Java Development Kit) which consists of JRE and JVM.
Java is WORA that is Write Once Run Anywhere provided that JVM and JDK installed.
Github repo : github.com/nav...
Java:- bit.ly/JavaUde...
Spring:- bit.ly/SpringU...
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com
This is the explanation which every java developer needs, Kudos and Thank you sir.
I work as Java developer since 2 years ago, and no one told me everything i watched in this video. Really thank you :)
This is the Marvelous Explanation sir Please provide Interview Questions Asked For Java Developers.
Thanks for the great and clear explanation! I didn't know this about Java when I started learning it.
Superb sir
Anyone in 2024❤️
Here bro
yepp
If VS Code gives you an error of the type "package system does not exist" make sure to have the "s" in "system" to be capital letter, alongside the first letter of string it also must be a capital letter.
If I ever learned anything in the Java world it is because of you sir!! Thankful forever!!❤
hii bro,i got an error in javac hello.java i checked the code also...and i didnt got hello.class? at 8:42
Thank you Navin Reddy my forever teacher since 2015
Wow, that's the type of instructors that all beginner in programming need
you explained this so beautifully! The most best part about your videos are unline others, you always try to give in depth knowledge on what happens in the backend which makes it more easier to learn.. I havent done coding in my entire life, but your videos are mind blowing!!! Keep explaining logic and concept wise..Great work!
Greatest Tutorial Ever In UA-cam.....
Literally, The way you explained !! I'm your fan!!
Hello, I'm From france and I'm learning java online and I found your channel when I first search for java videos. I watched all your java videos and thank you so much for these videos, I'm really grateful to you.
France 🇫🇷????
@@JEEVI-y2k quoi ? qu'entends-tu par France ?
@@JEEVI-y2k ah i get what you meant by that. yes I'm from france. you also???
@@NoahMichaelZ hii bro,i got an error in javac hello.java i checked the code also...and i didnt got hello.class? at 8:42
If I type `javac hello.java` and press enter, my class file is not created instantly. However, if I run the program and then type `javac hello.java` again, I can see the class file is created. Why isn't it created instantly as shown in the video?
Cool content. I subscribed.
Up to java 8 we could only install JRE to run purpose.
But for java 9 everyone has to install the whole JDK.
This is the explanation which every java developer needs, Thank you sir.
Hi Sir,
I have a problem.
My class is not getting created and I am unable to find why it is
Can you please help me
you are amazing, I have been learning Java for 1 year but now someone explained it correctly :D
Hi, is there any way I can see these things(JRE, JVM etc) in action? Any way to know what's happening at JRE/JVM level when I run a java program/application?
Different functions are available inside folders of jdk/conf
These functions execute all these
In my research I found: a 'static block' executing before 'main' method, So when we compile the code to byte and run through the JVM, the jvm look for main method or static block first?
May i know why the class is not getting created
Umm i got a problem. I could not the extra file after typing javac Hello.java
Hi, I was trying to run the code using javac Hello.java but I get this error
unnamed classes are a preview feature and are disabled by default.
public static void main (String a[])
(use --enable-preview to enable unnamed classes)
Anyone knows how to fix this? Just beginning to learn coding through this channel. Thanks!
*UPDATE*
All goods now. I was able to search it up in google. I just have to enable preview it. Thanks!
How to fix this?
The explanation quality of this video is outstanding, thank you so much my brother, may god bless you
hi bro can you please tell me why he not used package in his code and his code still running ?
This was the greatest explanation ever! Thank you!
Hi @Telusko, I hope you are doing well. First of all, thank you for this contents, however I have got confused when explained about the main method… when we use JSE we have a main method but in Jakarta we don’t have the main verb because is web application…
hi sir when i give the run command it says " Error: Main method not found in class hello2, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application " please tell me how to solve it.
The error is because you can't run a Java file without main method. Public static void main(String[ ] args) {
}
Note : we can compile (javac) the Java code without main method, but we can't run the Java code without main method
Very sharp explaining salute 🫡 sir
Hi Sir, Thanks for your videos. I have a doubt, how can system have JRE and JVM without installing JDK.
As per my knowledge, when we download and install JDK, JVM and JRE will be created.
correct, i also read this, jvm comes with the jdk not preinstalled with the os
Great Navin. Very Useful . Thank you for such wonderful video
After compiling its not giving byte code, please respond
super explaining
I think, you are the best java teacher
public static void main(String[ ] args){ // code ..} or public static void main(String args[ ]){ // code ..} is both correct ?
Yes
Hi Sir, from past month i am asking this doubt,plz do reply.My conecern is that is this course for absolutel beginners!!! I need to start from very scratch because i didn't even know what is public static void main ..so plz do reply for my query
Yaa bro 😊 even I am the beginner. You can start dude.ALL THE BEST. 😊
sir is jvm is pre installed with the os of any computer or when we download java (from oracle ) then jvm comes with it?
It doesn't come preinstalled but rather it comes after installing java
In summary:
The compiler compiles Java source code into byte code and the byte code (machine code) is then read by the JVM, processed and converted into instructions for the respective OS to understand.
Thanks! 😊
Bro needs to pin this comment bc the beginning was a bit hard for me to follow but this comment really helped everything click together. Thank you!
Sir after running Java code (Hello.java) successfully,the byte code( Hello class) is not appearing in left top corner sir why and bcoz of that it shows no class name as hello world
Mine also not appearing but when appeared..it printed hello world but after that whatever I want to print it is printing only hello world
Facing same challenge like yours..
Mee too
I think the file exist but it is hidden by vs code, check it in vs code settings
@@hondaxblade2127 Okay, lemme give a try..
Sir, thank you for the explicit explanation❤❤❤❤
Assalamualaikum sir, how you are ? I'm from Pakistani I watch your all video . Sir kindly upload advance java courses which based on industry requirements.
Walaikum salam
Jai Shree Ram 🚩🚩🚩🚩🚩
Love from India bro
Beautifully explained - Kudos
Congratulations, your explanation is the best! Keep going.
i like your explanation , my problem is english i will improve my english and my talk , for hear you again
8:30 no new file is created in my system after compiling . Why ?(btw jdk version is 22)
This is amazing I am able to understand java now!
Suppose Android app is made using Java. Does our Android phone have jvm installed to run the application.
Thank very much for your simple and understandable explanation, indeed, it's wonderful
Thank you so much sir... really your explanation too good easily any one can understand...
hello sir, where can i take the exercises to improve my skills? thank you so much 🥰
sir kya badhiya bataya hai apki english bhi bahut simple hai sab samjh aya or appne jo bataya mujhe bahut acha laga abb mai bhi placement lepaunga thanks 🙏✨
Best teacher❤
Hi sir . I wrote java program like u same but in terminal when i compile code error:- could not find or load main class Hello . What the problem can you tell me 🙂.
Bruh did you got the solution cause I too got the same prblm?
bro I love this man so much it is not funny
This is amazing you have taught me so much
Hi Sir , my byte code "hello.class was not created. Plz explain
You need press ctrl + s in order to save the code you have written in the file. then execute javac command. hope it works 🙂
@@bhanuprakash5703thankyou
@@bhanuprakash5703 thanks it worked
JDK contains JRE, and JRE contains JVM.
JVM need to build for particular OS.
why did you sir suddenly remove 'ln' from 'println' ?
execellent explanation sir
I am Facing a problem with running the code my class is not created after running the code please help me with it
Save the code before compiling the code
Amazing, greetings from Colombia
sir how did you compile the code , i am not able to understand , it all happened a bit too fast
Hello.Class was not coming how to fix it
helo sir ,i got an error in javac hello.java i checked the code also...and i didnt got hello.class? at 8:42
Thank you so much, your explanation is very good.
when I tried to run the Java file it didn't generate the class file in the vs code, what may be the reason?, when I tried javac version it showed me the latest installed version as well
You need to save the file before generating the class file.
sir very nice explanation ,thank you sir
byte code is not coming sir
Thank you for this very useful video!
i didn't get a class file after compiling,what do i do
Me same thing.. how to fix it ?
getting f0lllowing error,
Hello.java:3: error: cannot find symbol
public static void main(string a[])
Sir we can write println also?
yeah it's also used to print stmt in java , liittle diffrence is by using print it will print given stmt in same line, whereas println prints stmt in new line everytime
sir i did't get hello class extra file plz can u tell
How many platforms for writing java code ,vs and note pad NetBeans except these is there any
Eclipse and IntelliJ is the most popular ides those are using by most companies
sir i have an issue vs code says hello.java is non -project file what should i do?
Thank you for this video! It's very helpful, especially for beginners. We also created a video on a similar topic, but we talk about the key differences between Java and Python
Ur great sir🎉
Very good sir 💯✨
Sir it is coming main not found in the file .define main method . please help me sir 🙏🙏🙏🙏🙏🙏
Hello sir
I have a problem
That is,I can't run my project when I type Java Hello it not works😢😢
I solve my problem
Hi Sir,
My name is Tarun ! I am presently working in a non-IT department. Want to move to IT department on that basis i am learning java classes from your videos. I have watched your previous videos and installed VS Code successfully. After that i am attending this session i a have few queries. How can i contact you and solve my queries.......???. Your fast reply is much appreciated. Thank you.
simply great.
hi sir, i tried to compile i got no errors and also did not got class file. can you help why is that.
Same getting code runned but not getting class file
awesome man keep it up
I am not able to find the Hello.class byte code after running in the terminal..an solutions?
im having the same issue brother can you figured it out
1:48 I don't understand what u are talking about
Later, I understand it🙂
Why jdk required in our machine, if not required in friend's machine
awesome video!
Sir in windows it is showing error
kudos sir .!!
Sir, I am not able to compile. It is showing error. //PS D:\Java Programming learn> java Hello
Error: Could not find or load main class Hello
Caused by: java.lang.ClassNotFoundException: Hello
class Hello
{
public static void main (String a[])
{
System.out.print("Hello World");
}
}
Bro in system "S" Must be capital. I think every thing is good. Once again try it bro.
Inculcate the habit of keeping the names of both java file and class name the same.
If your file name is Helloworld.java then name your class as Helloworld
class Helloworld
{
public static void main (String a[])
{
System.out.print("Hello World");
}
}
It will give the output
Sir I got confused at the end. That our friend's machine only have JRE and JVM. JDK is not required.
Thank you so much sir for this beautiful content.....
JRE ( which contains JVM) is only required for executing byte code.
very helpful
Awesome.
I' m getting class not found exception
You are amazing
love from andhra
hey for me hello.class is not showing....i tried so many times
do anyone has this problem
@@VAISHNAVIREEE-2021 save the file
when i compiled the program i didnt find byte code wt is the problem any one can explain?
same problem for me brother ,did you get the solution
The Byte is not getting generated
Thank u bro❤
8:33 is still not clear i don't have the z on my terminal site i can't understand how he run it.
We got "z" in print statement because of the extension
It's not a problem