Let's now go ahead and write a Java program in Eclipse. 2
So let's just go ahead and launch eclipse. 3
It's just double click this icon here. 4
So first thing eclipse wants us to do is it wants us to select something as a workspace or we need to 5
create a new workspace workspace basically represents our application. 6
So it's the place where we on our source code gets stored. 7
So within a workspace we create a project and the project has this our source code and the workspace 8
and how more than one projects do. 9
And those projects can be interrelated. 10
Usually it's if there are multiple projects that are usually interrelated. 11
So there is already a workspace here but let's just go ahead and create a brand new one. 12
So let's browse a look see dry within C-Drive let me create a new workspace called Jayati to new folder 13
which is short for Jawa and. 14
OK. 15
OK here now eclipse would launch a new workspace. 16
Now if we go into our explorer let me refresh this as you can see it has created a new folder on my 17
C drive. 18
Congi ID. 19
So it's basically the workspace. 20
And within this workspace all the source code that we write in eclipse would get stored here. 21
OK so the project get stored here. 22
The project can also get stored there is an option to also write the project extra Netaji ID extra to 23
the workspace and then get to the workspace. 24
That option is also there. 25
OK. 26
So let's just go ahead and create one project. 27
So let's just close this welcome screen. 28
So before creating our project I would like to just take a moment to talk about something cardless gelap 29
perspective about prospectives perspective is basically it. 30
It basically represents a view of your project. 31
The project that you create. 32
It's a view of your project. 33
OK. 34
So here there is the Djala. 35
Each prospect do. 36
So that's getting shown by default if you want to see it look at other perspectives. 37
You just need to click on this icon called open perspective and hit all the different perspectives that 38
Eclipse provides. 39
And here is Ajalon one on here is a debug sort of just click on debug. 40
So it just brings a different view of the project and you can also create Java. 41
Let's just select Java and debug one table. 42
You know when we are covering the debug debugging listen we will be looking at that interface. 43
Ok now this is a different interface. 44
And so as we are selecting them they get laid out here and the top and we can switch across also. 45
So that's the perspective. 46
So basically it represents a view of your project. 47
Let's just look at the Java aspect do so within the Java perspective like you have these different frames 48
and each frame we call it as a view. 49
So here you have the package Explorer View and package Explorer have you as a name suggests it is used 50
for exploring your projects your packages. 51
So within Java library within the Java code that we create usually we have packages and within the package 52
just be how classes are if we select a particular class then the source code of that class show up shows 53
up here. 54
This is the textedit of this is the editor of view. 55
And here you know if you under if you're under a particular class file then the output of dight will 56
be shown here and you will get opened. 57
It's called as a console you know it gets open here and we'll be able to see the output. 58
Let's not worry about these other views here. 59
So these are the three main news that we have. 60
That's the perspective on the views. 61
So let's just go ahead and create a new project. 62
We are going to file new. 63
It's quick on this job project. 64
It's quoted as Eclipse best and we are saying that use the default location which means that it's going 65
to get created an NGO idea itself and the database and the execution environment that GRV that we are 66
using is Jawa as eat and we are saying that creates separate folders for sources unclassified. 67
OK so you'll have separate folders for both source code and the compiled classifieds. 68
OK hit next. 69
OK so as you can see a new project has got created here and here we have something called Jawa Bell 70
settings. 71
This is nothing but you know all the libraries that this particular code that we are going to write 72
is going to be shown here and we can add those libraries here. 73
But when this is called a Java belled settings on we will get back to that later in the next lesson 74
. 75
That's it. 76
And I just had to finish and if you see you'll have a folder called S R C and we are depending on this 77
library in Java. 78
I see one point eight. 79
Now let's just let's just look in the explorer 2. 80
So if you're going to JRD you can see there is a new folder called Eclipse disk that God created. 81
Click on that you will see SIRC. 82
So in this ARCI for you go to any source code that we cleared and gets stored here. 83
And once it gets compiled the compiled files will be stored in the bin folder. 84
Let's go ahead and create a class. 85
So let's just right click on the project and let's send. 86
And let's click on class Let's name the class as Hello world. 87
OK. 88
So modify this public superclasses dollar dog Langhart object and which method set up. 89
So would you like to create which just select this so that the main method would be auto created and 90
that's it said we can just leave it as it is. 91
Heck finish this work. 92
Create a new class as you can see the font sizes. 93
It's small. 94
So let's just add logic. 95
So for DAC we can go into the window and there is something called preferences. 96
Let's go ahead and hit preferences and preferences show you how all these options here. 97
And let's just select the first one with just Gendron and Biton gender you can see that there is this 98
thing called us once. 99
OK let's click on appearance and that is colors on phones. 100
Let's click on colors on fonts on within colors on fonts. 101
Since we are dealing with Jellico Let's go into Java and let's head this thing edit a text font. 102
OK so let's just click that and you can see that we have these different font sizes let's select 16 103
for example. 104
OK apply. 105
OK. 106
Now the font size has increased. 107
OK. 108
Now let's put some statements here. 109
Let's put this out statement system not out just typing this out. 110
Can crawl space that for being up this thing and you could click that you know the court is auto generated 111
. 112
Now let's just put them. 113
Hello here. 114
So in order to run this all we need to do is right click see Iran as unselect this Java application 115
option are the simpler way is to simply click on this button here or on us. 116
Let's just click that as you can see the console view has open now and it's showing the output here 117
. 118
Now by any chance if you happen to believe this here by me you know accidentally then all you need to 119
do is once again go back in big window and here you have show you show which is nothing but it shows 120
all the views that we have in this perspective. 121
OK. 122
So the one the one the view which we lost is the console. 123
So it's quick on that and it's back again with the output that was there earlier. 124
That's the console you. 125
Now let's go ahead and put some statements here. 126
So let's say long a was 42. 127
Now let's assign it to an I. 128
Now as you can see it is giving us a compilation error. 129
So you see this that red icon here it says Type mismatch because you cannot convert from long to and 130
. 131
OK. 132
Now when I save it it also gets shown here in problems view. 133
So if I expand it I can see the same message here. 134
Now let's just go ahead and fix this. 135
So let's put the typecast here and it's fixed. 136
So the error of the compassion has gone back to showing another yellow symbol here icon. 137
It's it's just a warning. 138
It says that the blue of the local variable is not used. 139
Right because we are not using the value I it is being used here but I is not yet used. 140
So it's just a warning it's not a compiler error. 141
And the same warning also gets shown here and. 142
Yeah. 143
So that's sub-Arctic like how you were running or you just click on this button here and you run it 144
. 145
That is one other thing I wanted to that is going to bring reference's. 146
So we look up how to change the font. 147
And there is also this option called editors if you go in to editor text editor here and you have some 148
other options like showing the line numbers by default because it has been selected here if you do this 149
and you say I applied. 150
So the line numbers would go heavy but we does I think really nice to have the line numbers so let's 151
just put them back and there are also other options here. 152
You can check them out and play around with them. 153
Also here in the package explorer we can explore the classes that we created. 154
So here is a Hollywood. 155
And here is a method that we created. 156
So if there were more methods they would have shown up here under under the class I find this is the 157
package name. 158
So when we created the class it picked the project name as the package name itself. 159
So we could have given a different name but we just let that be false as it as it is. 160
And here in the main method. 161
So if you're for the print alone if you just haul it over it here. 162
So I chose the Java doc off that particular print method. 163
So it allows us to look at the description of the matter. 164
OK. 165
And here is the class system and it says something about the system so it's a dollar Dawk for the class 166
itself. 167
Now let me just go back to here today Explorer. 168
So we this is the workspace and this is this odyssey for gold which has the source code. 169
Now if we go into Ben. 170
So it has the class files. 171
The classifieds that Gajah undeterred will be here. 172
So this is a package an eclipse d'Este and within Eclipse's we have the Holloway got class file. 173
So that's about it