Skip to main content

Mavan Step By Step & Java Portable set up

                                                  **********Portable Java Set up**********

Just paste below content in some bat file.Open any command prompt & call this JavaSetup.bat & then you will good to go for calling java -version.

rem Set the JAVA_HOME environment variable and insert it into the system path.
rem This will make the javac and java commands reachable from the command line.
set JAVA_HOME="E:\Java"

                                                     *************Maven Setup****************

Download maven binary & set JAVA & MAVEN_HOME

set JAVA_HOME="E:\Java"
Set MAVEN_HOME="E:\apache-maven-3.3.9"

After setting above in batch file (if temporary required) or in system/user variables check mvn -v for verification & it should display java & maven details.

Then Run mvn: generate command like 

mvn archetype:generate -DgroupId=com.amit -DartifactId=SampleJava

It will download all template's & will ask to choose a number based on required project type.

which template type you need you can check by below trick.

 mvn archetype:generate > templates.txt

//waite for a minute, then exits
Press CTRL + C

just run & save it some file.After that check file where you redirected template types & choose required template. It will ask for version you may give maximum.

I provide 650: from template.txt which says 
ml.rugal.archetype:springmvc-spring-hibernate (A pretty useful JavaEE application archetype based on springmvc spring and hibernate)

then will ask couple of things like version etc just keep press enter & it will take all default. 

** if you get some error like plugin not found you can check if there is internet issue or proxy issue. If you are behind your office firewall you can set up proxy details in settings.xml file.


OK so when you will select input project will be generated.

Okay we have done it but one last important thing.If you want this project to work with in eclipse ide use below command & you will all set. Project will be converted for eclipse.

mvn eclipse:eclipse

Simple import into eclipse as open project from file system & we are good to go. Set up Done.

## To install external jar if some issue occurred in downloading jar via maven pom.xml

mvn install:install-file -DgroupId=hibernate -DartifactId=hibernate3 -Dversion=3.2.3.GA 
-Dpackaging=jar -Dfile=C:\Users\training63\.m2\repository\hibernate\hibernate3\3.2.3.GA\ -e


Popular posts from this blog

Conversion from Clob To String in java and Vice versa

/***reading Clob data from oracle table and setting to Pojo**/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import oracle.sql.CLOB;


public class MessageDao {
private static String url = "jdbc:oracle:thin:@";
private static String username = "ABC123";
private static String password = "ABC123";

public  List readClobToBO() throws Exception {

Connection conn = DriverManager.getConnection(url, username, password);
PreparedStatement stmt = conn
ResultSet resultSet = stmt.executeQuery();
List msgList= new ArrayList();

while ( {

StagedMessage message = new StagedMessage();


Portable Java 8/ JDK8 setup without admin rights

Some time we got machine to work where we don't have access rights to install anything or if you do not want to install. You can get latest jdk running by this trick. Just follow step step & do comment if you like it.

Step by Step details to get running java from .exe setup without any admin rights. Get portable 7 zip from portableapps.comdownload java 8 from oracle 7 zip & extract jdk-8u102-windows-x64.exeyou will see below folders                .data                .pdata                .rdata                .reloc                .rsrc                .text                CERTIFICATE

          5.Go inside E:\jdk-8u102-windows-x64\.rsrc\1033\JAVA_CAB10you will find 111 file.

         6.extract it it some folder where you can find again extract that to some folder say Java & copy it to very first folder of setup along with .data,.rsrc etc.
         7.Go to folder where you have co…

GOF Design pattern with Java & Real World Examples

What are design patterns? 

So basically these are just collection of best practices to solve recurring problem by different kind of class arrangement. These arrangement could be based on creation of object or structural basis or on basis of required behavior.

Creational Design Pattern
Prototype Designpattern we will like to use this designpattern whenever creation of initial object & setting required default values is costly. So we just create 1 object & later on whenever more objects required we can provide initial object by just cloning of given object.Java Example is java.lang.Object#clone()
Builder DesignPattern When we jave object structure are complex and complicated we would go for this. we will be separating object creation from internal representation. With help of some simple interface we would create complicated Object.
Singleton When we need one instance per JVM. Example : Java Run time environment Java.lang.System.  java.lang.StringBuilder, Spring Beans are singleton …