Setting up Java Development and Maven, Adding JUnit, Selenium to project

 Modules 

1. Installing and Running Java

    a. Hello.java is converted to Hello.class (bytecode) by java compiler to be able to run in any OS.

    b. It needs two things

            i. Java virtual machine (JVM) - read bytecodes and executes instructions

            ii.  Java Standard Edition(SE) API (Like System.Out. class)

            - Combining these two components, java, javac are called JDK.

            - Another set - Java Enterprise Edition (EE) API - For Web Development etc

            - Java EE are renamed as Jakarta EE

Steps:

   a. Download Java SE JDK  (jdk.java.net) - Download release - OS - Extract the zip to c:\programfiles

   b. Setup JAVA_HOME env variable - c:\programfiles\java-vlatest

   c. Update PATH variable - Add -  c:\programfiles\java-vlatest\bin

   d. Verify - Run java --version in cmd

   e. Create a file - hello.java - public class Hello {public static void main(String[] args) {      System.out.println("hello world from JDK"); } }

 Run  the following commands

       - javac hello.java

       - java hello


2. Installing IDE ( IntelliJ) - if needed

   https://www.jetbrains.com/idea/download/#section=windows


3. Install Maven - build tool 

   a. Goto https://maven.apache.org/download.cgi and Download apache-maven-v-bin.zip file

        


  b. Extract them on to any location on PC and add it to the PATH env variable


  c. Run mvn -version in cmd prompt



4. IntelliJ IDEA -> File -> Settings -> BuildTools -> Java -> Set ByteCode version -> Latest Java version installed on the computer


b. Also Check the Maven -> Runner -> Set to Latest JDK version

6. To Add Junit to the Project using Maven

  a. Goto Url: https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api

    Select latest version : https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api/5.7.0-M1

    Copy the dependency section


b. Goto pom.xml in your project: Add this to the dependencies section -> Reload -> It should create some JAR files in External Libraries section

  


    
7. Adding Selenium to project: Same as Above steps:

https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/3.141.59

Add dependency to pom.xml

Comments