• 18 February

    Spring Autowiring byName

    Spring autowiring byName means autowiring on the basis of name. If any bean property matches with exact one other bean’s name declaration then spring will automatically takes care of dependency. Below diagram will make it clear: For example: I am taking example of autowire “byName” here.It will be almost same as Dependency injection via setter method with […]

  • 18 February

    Working with formulas in excel using Apache POI in java

    Java Apache POI tutorial: Read excel files in java using POI Write excel files in java using POI Working with formula in excel using POI How to set style in excel using POI In this post, we will see how to set and evaluate formulas in excel using Apache POI. Set formula for a cell: […]

  • 17 February

    How to set style in excel using Apache POI in java

    In this post , we will see how to set style in excel using apache poi. You can put cell style with below code: // create font XSSFFont font= workbook.createFont(); font.setFontHeightInPoints((short)10); font.setFontName("Arial"); font.setColor(IndexedColors.WHITE.getIndex()); font.setBold(true); font.setItalic(false); // Create cell style CellStyle style=workbook.createCellStyle();; style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setAlignment(CellStyle.ALIGN_CENTER); // Setting font to style style.setFont(font); // Setting cell style cell.setCellStyle(style); Java […]

  • 15 February

    How to write Excel files in java using Apache POI

    In this post, we will see how to write excel in java using Apache POI example. About Apache POI project : The Apache POI Project’s mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). In short, […]

  • 14 February

    How to convert existing java project to maven project

    In this post, we will see how to convert existing java project to simple java maven project. Steps for converting existing java project to maven project: Step 1: Install m2eclipse for maven plugin in eclipse. Please follow this link for installing m2eclipse plugin in eclipse. Step 2: Right click on project -> configure -> convert to […]

  • 13 February

    How to read excel files in java using Apache POI

    In this post, we will see how to read excel in java using Apache POI example. About Apache POI project : The Apache POI Project’s mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). In […]

  • 13 February

    How to detect OS in java

    In this post, we will see how to detect OS which you are using. You can use System.getProperty(“os.name”) to get current OS name. Sometimes , we need to write logic based on OS, so we get use this logic to detect current OS. Java Program: package org.arpit.java2blog; /* * @Author Arpit Mandliya */ public class […]

  • 13 February

    How to get home directory in java

    In this post, we will see how to get user profile’s home directory in java. It is quite simple, we can use System.getProperty(“user.home”) to get it. Java program: package org.arpit.java2blog; /* * @Author Arpit Mandliya */ public class getHomeDirectoryMain { public static void main(String[] args) { System.out.println("--------------"); String homeDirectory=""; homeDirectory = System.getProperty("user.home"); System.out.println("Home directory is […]

  • 12 February

    How to move file to another directory in java

    In this post, we will see how to move file to another directory in java. We will use java.io.File ‘s rename(File dest) to do it. In below example, we will move config_new.properties from /Users/Arpit/Desktop/Folder1 to /Users/Arpit/Desktop/Folder2 . Java Program: package org.arpit.java2blog; import java.io.File; /* * @Author : Arpit Mandliya */ public class MoveFileMain { public […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.