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…

Multi Threading , Producer consumer problem in Java

Multi threading is topic which is always fascinating for java developer. I feel its more about practical the theory. So here i wanted to present sample examples which clear understanding for several multi threading concept.

In Theory basically thread which is light weight process.Thread shares mostly same memory space.
I said mostly because there is some space called thread local which is not common to threads & separate for each thread. We create thread whenever we wanted to use multicore of processor although that doesn't mean single core cant use it. In single core context switching works among different running thread.

for example suppose there is website which is showing latest price as well as offer as well as doing order booking all these things can be assigned to different thread to provide parallel processing.

There are 2 ways for creating a thread.

Extend a thread & Implement a Runnable class. Extending a class is little avoided since it closed possibility for e…