My Coding Pains

The Code, The Bugs and The Stack Trace

Setting up environment for java application development

Hello,

This is the first part1 of my series on Maven, Spring and hibernate put together. I hope you it will be appreciated that I started from this point. Let’s get started:

Install java development toolkit

windows machine
download and install jdk 7+ in :

Linux Ubuntu
[bash]
$ sudo apt -get install openjdk-7-jdk #this will install l java app
[/bash]

Mac

  • Download java-package.dmg and double click

install subversion

Windows Machine

  • download and install from collab.net or install tortoise subversion install subversion

Linux Ubuntu
[bash]
$ sudo apt-get install subversion #or install rabbit svn from repository
[/bash]

install maven

Windows machine

  • download binaries from adorable maven site
  • unpacked inside C:\\maven

Linux Ubuntu

installing maven in /usr/local/maven it’s strongly advised on Linux
download and install maven under the indicated directory. Check this to get it done properly

install apache tomcat

Windows machine
For the purpose of a development machine we suggest, installating in C:\\java folder
download and unzip tomcat under the mentioned directory.

Linux Ubuntu
We also suggest to download the binaries files and unzip it under /home/yourname/tomcat or under /opt/tomcat making sure you have full privilege on the folder

Mac
download binaries and unzip under /Users/yourname/tomcat

Install mysql server

Linux Ubuntu

[bash]
$ sudo apt-get install mysql-server mysql-client
[/bash]

Windows

Find all necessary information on netbeans

Mac
Find all necessary information on mysql

set environment variables

setting java_home environment

Windows machine

  • go to desktop
  • right click “my computer ” icon
  • click on advanced tab
  • click on environment variable button
  • under system variable click on new button
  • in variable name textbox write JAVA_HOME
  • in variable value textbox write path-to-your-java-folder (eg C:\\Program Flies\Java\Jdk-version-number)

Linux Ubuntu

[bash]
sudo nano /etc/environment
#append to the file:
JAVA_HOME="/path/to/your/java" #eg: /usr/lib/jvm/java-1.7.0-openjdk-amd64
[/bash]
crtl+x to save

Mac
On Mac java home is usually under /Libraby/Java/Home, but there is a tool to find out , run in a terminal /usr/libexec/java_home to see the location of java home
[bash]
pico ~/.bash_profile or touch ~/.bash_profile
#append the following to the file
export JAVA_HOME=$(/usr/libexec/java_home)
[/bash]
ctrl+x to save

setting of maven home

Windows machine

  • go to desktop
  • right click “my computer ” icon
  • click on advanced tab
  • click on environment variable button
  • under system variable click on new button
  • in variable name textbox write M2_HOME
  • in variable value textbox write path-to-your-maven-folder (eg C:\\Maven)

Linux Ubuntu
[bash]
sudo nano /etc/environment
#append to the file: M2_HOME="/path/to/your/maven" eg: /usr/local/maven
[/bash]
crtl+x to save

Mac
[bash]
pico ~/.bash_profile or touch ~/.bash_profile
export M2_HOME=/path/to/your/maven
[/bash]
ctrl+x to save

setting of catalina home

  • go to desktop
  • right click “my computer ” icon
  • click on advanced tab
  • click on environment variable button
  • under system variable click on new button
  • in variable name textbox write CATALINA_HOME
  • in variable value textbox write path-to-your-tomcat-folder (eg C:\\Tomcat)

Linux Ubuntu
[bash]
sudo nano /etc/environment
#append to the file:
CATALINA_HOME="/path/to/your/tomcat" eg: /usr/local/tomcat. or /home/yourprofilenam/tomcat or /opt/tomcat
[/bash]
crtl+x to save
in variable value textbox write path-to-your-tomcat-folder (eg C:\\Tomcat)

Mac
[bash]
pico ~/.bash_profile or touch ~/.bash_profile
#append to the file the following
export CATALINA_HOME=/path/to/your/tomcat
[/bash]
ctrl+x to save

Attention Required

When running some of dreamoval web appliations , some might cause tomcat to run out of memory. That is because tomcat is running with default max imum memory size. A quick fix to that is to set some parameter to tomcat because it starts. That is done by putting a setenv.sh or setenv.bat file under the bin folder. These are just default “increased” value, thus it can be adjusted based on need

Windows machine

  • change directory to Drive:\\path\to\your\tomcat\bin
  • create setenv.bat file
  • put in: set CATALINA_OPTS= -server -Xms512m -Xmx768M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled

save and close the file

Linux and Mac machine
[bash]
cd /path/to/your/tomcat/bin
nano setenv.sh
#append the following to it
export CATALINA_OPTS="-server -Xms512m -Xmx768M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled"
[/bash]
save and close the file

That’s it you are ready to go. Next we will talk about setting up your project

Leave a Reply

Your email address will not be published. Required fields are marked *

captcha * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top