Java + Maven + IntelliJ Basic setup

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey hi friends in this video we are gonna have a look at how to install and set up java and then maven and then finally intellij on our systems i'm using a windows system so the steps that we discussed today would be valid only for windows and they might change for mac and linux os okay so without further ado let's go ahead and do these things okay so first let's go ahead and actually verify whether we have java already present in our system or not for that open your command prompt and type in the following command java java hyphen version okay and i can see that at that i already have java 11 installed in my system right but the thing to note over here is that this shows the java runtime environment and this necessarily does not mean that you have java jdk or java development environment that we require already installed all right so what i want you to do is type in the following command where java that is if you get an output for java minus version so this would show you where all this java executable is present right i can see that it is present in my common oracle's java java path this is your jre or rather your runtime environment runtime java and this is your java development okay i can see that i have jdk 11.8 already present this these values come from your environment variables we'll look at how to configure that also in this particular video right but first uh now since i already have 11 let's upgrade right so i'll upgrade to the latest java version that is available all right for that i would be opening my browser i would be using firefox right and over here search for java jdk download right and over to the oracle official website just click on the first option that i get and i can see that we have java 17 available now let's try installing this so i'll hop over to the windows section and then use a 64 installer okay you can use any one which you want but i would prefer use either of these installers as they would you know guide you through most of the stuff okay so let's install this or rather let's download this for it to download okay my download finished okay so my download finished let's open this okay right double click start yes next see program files java jdk 17 next i'm happy with my file but then wait for this to finish all right so my develop so my installation is complete i'll just clone go ahead and close right next let's go back and verify whether this got installed or not so i will again do java minus version okay so i've got java 17 i think my installer also modified my environment variables but even so i would actually go ahead and verify all right in order to verify the first thing i would do is i would type in again the java all right so here i can see that my java jdk path is still pointing to java level all right so contrary to what i believed my environment variables have not been updated so let's go ahead and update them okay so in order to open environment variables go to your windows search and type envir environment okay and even before you finish typing you would probably have this particular option available edit the system environment variables okay click on that and in the system properties click on environment variables right and in this section we would be working with system variables right and in system variables uh you would need java home if you do not have this already you would have to create it using the new okay let me do one thing uh let me delete this particular one and create a new java home variable so this variable name would be j a v a underscore oh in all caps and its value would be your java location mine is in windows program files java jdk 17 you would be also having this at a similar location all right then in this particular location go to bin copy the entire thing and paste it in variable value but one thing to note again over here is that in java home you would not require the slash bin so delete that part click on ok to save this next go to your path okay in path i would be adding a new java variable a new section right rather just click on new and paste in what you copied okay and if you already have something you know if you already had earlier version of java i would suggest you delete that particular entry right like i have java 17 over here that i just which i just did for practice so what i'm going to do over here is that i'll click on this and i will delete this okay and i will just do an ok but be very careful while deleting or doing something generally while deleting because these are system variables and you would not want to delete a windows system variable that will actually cause a lot of problems all right so just click on ok now and yeah that's done your java is installed and configured now let's go back and actually let's do aware java here so here you would find that you still have jdk 11 being listed away what you need to do is actually close this particular command prompt and open a new command prompt right and in your new command prompt now do a ver java again now it would be pointing to 17 or rather now it will show that it is pointing to 17 earlier because it was an old instance it was picking up java level right so with this here java configuration is done okay now let's go ahead and install intellij for that open your browser first i would go ahead and open firefox and then in the search for search for inte lli intelligent open the first option or rather open www.jetprints.com click on download then select the particular section that you have or rather select the section that corresponds to your os i have windows so i would be using windows and then go ahead with downloading the community edition or ultimate edition if you want to be i am going for the free edition right now so i would download the windows.exe and wait for this to finish okay first click on save wait for this to finish okay so my download is done i will just open this file now it's just a matter of following the wizard next yes i'm fine with this location i want to create my desktop shortcut i also want to update my path variable open context menu okay let's go ahead with that create associations.java.com let's create associations with everything and just click on next install wait for this okay so my installation is over now i would just go ahead and reboot the system and see after my reboot is done okay so my system has rebooted and i have my intellij installed okay so before going ahead and configuring this intellij let's first install maven right and installing maven is actually pretty simple when you compare it with others uh all you need to do is extract you know download the zip file extract the zip file and add few variables into your environment variables right let's go ahead and look at that okay so again i would open my browser i'll go ahead and fire up firefox search for maven then from maven.apache.org i will go to that and then in the use section you will find this download button this download link right click on this download link and over here you will have the mirror side this is the site from where you would actually be downloading your file if you want to change you can go ahead and change that but this would work in most cases right then scroll down to the files section uh these are the things that we would be downloading not all of them obviously i would be i would just be downloading the binary dot binary zip archive right that is because i'm using a windows system if i was using a linux based system or if i was using mac i would have downloaded tar dot gzip so just click on bend.zip i will save this and wait for okay so that my download is also finished i would go ahead and open the location okay so let's first copy this somewhere right i'll go to my c drive just make a folder over here as maven and first paste this over here then i would extract it i'm using 7-zip you can subsequently use whatever extraction software you want you can use winrar zip anything you want right so i'll just just extract files see maven yeah right okay and once this is done i have got an extra folder that doesn't matter okay so here i would copy my path i would be needing this path while setting up the environment variables all right so next let's look at setting maven environment variables so again like we did in case of setting up java environment variables go ahead and search for environment and before you finish typing you will have the edit the in system environment variables option open this go to environment variables and then again in the system variable section we would this time be adding actually two variables right so the first one that we would be adding would be maven whom all caps m m a v e n underscore h o m e and in this we would provide address just before the bin right we will not include slash bin so it would be up till over here let's go back so up till over here right and just press ok next one that you would be required needing is m2 m2 underscore home now why these two variables actually may even uses these at certain points so it's a requirement let's just get it done with right and paste in your path but this this time include till then yeah my caps on pen fine so this time it will be up till inside this folder all right again press ok now one more thing that we would have to do is add the address in our path variable so open your path click on new and just this one will also be up till your binary so up till then okay okay one more thing uh we added all our variables in our system variable sections right and not in the user variable section the reason being that i have just one user in my system and i want my maven to be available and even if i use multiple users if i or even if i make multiple users as this is my personal system i would want my maven to be available for all users right but if you want something like your maven path variables to be available on able to be configured only for your particular user that you have logged in with you can create these in your user variable sections also okay that would also suffice but then again i would say then you would have to add the the even address in your user variables path section also all right but i would suggest keep it in your system variables it's not that big of a deal all right so press ok and okay again so that takes care of my maven configurations next let's go ahead and try running a sample program in eclipse and do the necessary configurations whatever is required for our intellij sorry i said eclipse last time intelligent all right so let's start our intellij okay just minimize these and double click on intellij okay so once your intelligence starts up uh the first time you would have a page something like this right wherein you will have a list of all your available projects i have i have this from my previous version of intellij wherein i was creating some projects right but right now uh let's go ahead and create a new project okay so click on new project and over here i would say let's make a maven project click on maven now in the right hand side you would see there is something known as project sdk right so this is telling which version of java you would want to use so i have 11 over here because previously i was having a java 11 that i selected but it says that it has deducted another sdk that is java 17 version i would click on this so that it defaults to java 7. okay now i would just skip the archetype selection and just click on next okay so in my name i would say let's create a selenium project a basic selling in project right so that way we would also test our repository downloads so i will do a basic cell rather hello okay and in my group id i would say or dot let's say com.example a rather test dot example so these are just naming conventions generally in group id you put in the reverse of your domain name since i have no domain name but i also want to follow conventions i would be using test.example you can give any any other thing also right your artifact id is generally same as your name so i've kept that and version is 0.1 snapshot let's just finish this and wait for intellij to do its magic right so here i have everything ready ready my pom.xml file has been created by intellij it has added its uh compiler properties like maven dot compiler 17 saying that we're using java 17. and most of the things are done now let us go ahead and get our first dependency for that first put in the dependency tag the epen okay it is asking me something you must accept the terms of legal notice of beta0 to enable support for 17. okay i'll accept it that's fine so let's go ahead and add in our first dependency for that again i'll open my firefox search for maven report repository go to maven repository then search for selenium [Music] selenium java click on that okay it's for rc lab would be using itself right now click on it it has copied it already to my clipboard but i still like to do a ctrl c next i'll just paste this over here so generally as soon as you paste it intellij would start with the download of your dependency but in case it does not right click okay then point to maven then do a reload project okay right so let's look at our external libraries now i have got all my selenium libraries over here okay so that does it that's how we are going to get all our dependencies okay so that concludes our setup part right now let's just quickly write a sample code and finish this off i would be using selenium and junit to write a code that opens the google page and searches for something or rather just opens the google page okay let's go ahead and do that all right so i wrote a quick test to open a google page using edge driver and also i used bonnie garcia's web driver manager to get my edge driver and with that i used junit okay so you will notice these two arrows this would run my code okay so i'll just click on this and run test all right so this worked and that was the basics for setting up your java maven with intellij okay and yeah that was all for this video thanks for watching and hope you have a great day
Info
Channel: Omega Automation Testing
Views: 18,889
Rating: undefined out of 5
Keywords:
Id: dgiQyx13X0M
Channel Id: undefined
Length: 23min 59sec (1439 seconds)
Published: Wed Oct 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.