Saturday 15 March 2014

Java Tutorial - Part 1

This article simulate what you will go through in the first day of job. The ultimate goal of the first day is to setup your working environment.

Prerequisite

  • 2 hands, 10 fingers
  • 2 eyes
  • 1 computer
  • 1 functional brain.


Setup environment

1. Download Java
  • Create one folder named "java" to store all your related development stuffs. In my computer, it is E:\java. If you use Linux or Mac, can set it to "~/java"
  • Download latest jdk version (currently v1.7.0_51). Install it to "java/jdk1.7.0_51". It is advisable to avoid extracting to "C:\Program Files" because this folder name has space. Please remember to keep the jdk version number in folder name because it is likely that we will need to have multiple jdk versions in the future. 
2. Download Maven 
  • Go to http://maven.apache.org/download.cgi and follow the instructions to install Maven. As above, please do not put Maven in your program files folder. I would recommend to put it in "java\apache-maven-3.2.1".
3. Download Tomcat
4. Download IDE
  • There are 3 well-known IDEs and all of them are perfectly fit for java development: Eclipse, Netbean and IntelliJ. If you have never heard about them I would say Eclipse is like Linux, NetBean and IntelliJ are like Windows . Eclipse is developed by community, difficult to configure but very customizable. This tutorial will use Eclipse as the default IDE. 
  • Create folder "java/workspace". Start Eclipse, it will ask for workspace folder. Please point to the folder we just created.

Discussion & Thinking 

  • Many of the popular tools and applications need JAVA_HOME to find out JRE or JDK to launch Java process. This practice is preferred over calling java from command line so that it is possible to have JRE available at system path for general use and JDK is for development. In case you need to use different version of JDK for different process, setting JAVA_HOME for each console is easier than modifying system path.  

  • Can take a look at mvn.bat or mvn in "java/apache-maven-3.2.1/bin" folder. Maven use the JDK/JRE as specified by JAVA_HOME.

  • Take a look at file eclipse.ini in the eclipse folder. This is the configuration file for eclipse. The default memory setup for Eclipse is a bit low, you can set to higher value if your computer have more Ram and you are going to develop more than one project. This is my setting
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
  • Open Eclipse, let navigate to Help -> About Eclipse -> Installation Detail -> Configuration. Verify that your memory configuration in the earlier step really take effect. 

Other References

6 comments:

  1. The Collection Marts is platform where you can view latest designs about home décor and bedding. We have large range in different categories with finest fabric in cotton and silk. You can view not only present trends but also view huge collection with reasonable price. polycotton sheets , queen bed comforter set , alkaram bed sheets , fancy nancy twin bed set , buy duvet covers online , vicky razai factory , 3 piece sofa covers , velvet sheet set , velvet razai cover , best bath towels 2020 The Collection Marts can provide fast service about delivery as well as customer support too. Our products are not only self-made but also, well connected with markets to ensure for possibility of available designs if client want to purchase. The Collection Marts customer support open 24/7 to guide their customers about material or product stuff.

    ReplyDelete
  2. So delighted to have visit this amazing blog, very much excited to have read through your page, really appreciate you for this fantastic reads, I definitely liked every part of it and I look forward to reading new article information in your site. Thanks for sharing. Meanwhile check how SSU post utme past questions pdf

    ReplyDelete
  3. I really enjoy reading your well-written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work. IVC scholarship past questions & solutions pdf format

    ReplyDelete
  4. Fantastic informative blog, such an amazing insight you have on this excellent information provided by your article, thank you for taking the time to share with us such a nice article. Download dpr past questions

    ReplyDelete
  5. This an excellent article blog, it offers solutions to difficult questions, the easy description can make a difficult thing understandable, and you put so much effort to discuss everything in clear terms, thanks for sharing. zamsu approved school fees schedule for new students

    ReplyDelete