2011년 8월 18일 목요일

Fedora: Setting up Spring framework development environment

I'd like to describe my java development environment. All of these jobs were proceeded in a VirtualBox VM which Fedora 15 installed.


1. Download JDK and JRE 
Open java 1.6 had already installed on my machine. But I wanted to install the latest version (1.7). I visited Oracle download site and downloaded the latest RPM for x32.



2. Go to the terminal and execute these RPM files
# User switching to root
[yeonki@localhost ~]$ su -


# Giving all users the execution permission for files start with j
[root@localhost Downloads]# chmod a+x j*


# Installing JDK and JRE, both were installed respectively on "/usr/java/jXX1.7.0/".
[root@localhost Downloads]# rpm -Uvh ./jdk-7-linux-i586.rpm
[root@localhost Downloads]# rpm -Uvh ./jre-7-linux-i586.rpm


3. Make the newly installed one have priority when java invokes

[root@localhost Downloads]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0/jre/bin/java 20000
[root@localhost Downloads]# alternatives --install /usr/bin/java java /usr/java/jre1.7.0/bin/java 20000


4. Checking the precedent commend.

[root@localhost Downloads]# alternatives --config java
There are 4 programs which provide 'java'.


Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 3           /usr/java/jre1.7.0/bin/java
   4           /usr/java/jdk1.7.0/jre/bin/java
Enter to keep the current selection[+], or type selection number:  3

#Checking java

[root@localhost Downloads]# java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)




5. Add JDK path to JAVA_HOME
[root@localhost Downloads]# export JAVA_HOME="/usr/java/jdk1.7.0"




6. Download Eclipse
I downloaded Eclipse IDE for Java EE Developers from http://www.eclipse.org/downloads/.
Eclipse Indigo that I downloaded is 3.7. (Helios is 3.6.)


#Untart the file.
[yeonki@localhost Downloads]$ tar -zxvf eclipse-jee-indigo-linux-gtk.tar.gz


#Move eclipse directory to working directory (/home/yeonki/)
[yeonki@localhost Downloads]$ mv eclipse /home/yeonki/Desktop/eclipse/




7. Install Java EE 
I downloaded Java EE 6 SDK Update 3  from Oracle site.


[root@localhost Downloads]# ./java_ee_sdk-6u3-jdk7-linux-ml.sh
Extracting the installer archive...
Extracting the installer runtime...
Extracting the installer resources...
Extracting the installer metadata...
Welcome to GlassFish V3 installer


Using the user defined JAVA_HOME : /usr
Entering setup...
SwixML 1.5 (#144)
File 511/511
File 303/303
File 564/564
File 317/317


8. Install Spring framework
I downloaded the latest Spring famework 3.0.5.RELEASE at Springsource


#Unzip the file.
[yeonki@localhost Downloads]$ unzip spring-framework-3.0.5.RELEASE-with-docs.zip

#Move spring directory to working directory (/home/yeonki/)
[yeonki@localhost Downloads]$ mv spring-framework-3.0.5.RELEASE /home/yeonki/spring-3.0.5/


9. Run Eclipse and Add Spring IDE integration


Go to Help->Install new software


Input the following address http://springide.org/updatesite in the textbox and click Add button.


Input name in the window.


Select components. In these case, I selected Core/Spring IDE, Extentions(Incubation)/Spring IDE and Resources/Spring IDE. If you need to more components than me, I may need addition software, for example, AspectJ Development Toolkit or Maven integation. (You can install these from the menu: Help -> Software market.)



After completed the installation, Eclipse needed to restart.




-------------------------------------------------------------------------------------------
Added 2012-01-26


How to install Sun JDK and have priority when java invokes on Ubuntu
1. Install Java

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk


2. Give priority on sun-jdk 

$ sudo update-alternatives --config java


selection   Path                                                 Priority  Status
--------------------------------------------------------------------------------------
  0          /usr/lib/jvm/java-6-openjdk/jre/bin/java  1061     auto mode
  1          /usr/lib/jvm/java-6-openjdk/jre/bin/java  1061     manual mode
  2          /usr/lib/jvm/java-6-sun/jre/bin/java        63        auto mode
Press enter to keep the current choice[*], or type selection number: 2


$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)




Reference sites: 
1. http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
2. http://www.lamolabs.org/blog/5562/5-minute-guide-to-using-the-alternatives-command-on-fedoracentosrhel/

댓글 없음:

댓글 쓰기