Maven : How to configure Maven into your Windows Machine

Maven is a powerful tool that is used for projects build and dependency management. 
Let see how you can configure Maven into you Windows machine.

Step1 : Download the Maven binary from you offical site. 



Step2 : Extract the binary and save it in some location.
        Let say c:\users\qahumor\maven

Step3 : Now we have to set Environment Variable for Maven.
        Right-click on My Computer ->Properties -> Advanced System Settings.
        Under Advanced Tab -> Click on "Environment Variables".


Step4 : Then click on New in System Variables.

Step5: Provide Variable name = M2_Home and Variable value = path where you saved &
       extract the maven binary ,in this case c:\users\qahumor\maven
Step6 : Select Path variable in System Variables and click on Edit 
        (be careful while changing anything).

Step7 : Go to the end and enter value like - ;%M2_Home%\bin
        (make sure to put semi-colon incase if its not present) and hit OK.

Step8 : To check whether Maven is configured properly.
        Open command prompt and type these commands

       -> mvn -version  [To see the version of maven into your pc]
				&
       -> mvn clean  [This is command to clean the project , you will see Build Failure ,
                      this is expected as you don't have POM.xml file as of now]
		
Thank you!!

Java : How to read data from properties file

How to read data from properties file


The Properties class represents a persistent or defined set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string.
Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object.

The Properties file is highly used in automation. Let see with an example.

package com.qahumor;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;

public class Reading_PropertyFile {

 /*
  * @author : Qahumor Reading Properties file in Java
  */

public static void main(String[] args) {

// Create an Object of Properties class.
Properties prop = new Properties();

// Get the path of properties file which you have created in your project.
// System.getProperty("user.dir") - help to read the root directory of your project.
// Change the below path accordingly.
String path = System.getProperty("user.dir") + "/src/config/test.properties";

// Print the path of file for Debug purpose
System.out.println("Debug : Properties file path :" + path);

try {

// Reading the File input stream
 FileInputStream fs = new FileInputStream(path);

// Load the file into memory
 prop.load(fs);
   
} catch (Exception e) {
 e.printStackTrace();
}

// Read the value from Property file - test.properties
System.out.println("\nVersion of the Property file is : " 
    + prop.getProperty("version"));

}

}

Output:

Version of the Property file is : 3.1.4




@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

To create a property file:
1. You can open a notepad
2. Type below content in it.
    version=3.1.4
    login=admin
    pswd=xxxx
3. Save it name "test.properties" in double quotes.
4. You can download the sample property file from Link


Thank you!!





How to create Firefox profile on Windows OS

How to create Firefox profile


Sometime we need to create different profile other than default profile 
of Firefox for new users or for any troubleshooting or for web automation.

To do this Firefox provide -P option to create new profile. 

Let's see how to achieve this.

You can watch Youtube video or follow the steps mentioned below






Step1: Make sure you close all the running firefox instance on your system.


Step2: Now press Windows+R to open RUN window.


Step3: Now type " firefox -P "  or "firefox.exe -P" and hit enter.



Step4: It will open "Firefox - Choose user Profile "  window.


Step5: Click on "Create Profile" option , it will open "Create Profile Window"
       then click  on Next button.


Step6: Provide the new profile name and choose the folder(if you would like to
       place the profile in some custom folder) and click on Finish.


Step7: Now you can see the newly created profile . Select and click on 
       "Start Firefox" button and navigate to folder (either default or custom
       folder) where you have placed the profile, you can see lots of files 
       got created in it.   






You can subscribe to my Youtube channel @ QAHUMOR


That's it , let me know if you have any comments.


Android : How to connect your Android device over Wifi using ADB command for App debugging

How to connect your Android device over Wi-Fi using ADB command Sometimes it requires to connect your Android dev...