[03-D3] 자 바 언어의 이해, 자바 개발 환경 설치하기, Ubuntu 10.04 개발 환경 설정

[01] 자바 언어의 이해
 
   1. CS(Client/Server) 프로그램의 개발 가능
      - Visual Basic, Power Builder, Delphi, JAVA
      - 인터넷 브러우저를 통해 접근하는 것이 아니라 데이터베이스에 접근하기위한 프로그램을 따로 만들게 됩니다.
      - 특정 그룹을 위한 관리 프로그램이 대상이 됨
        . 비디오/도서 대여점등 사용자수가 적고 한정되어 있는 경우
        . MS 메신저의 경우도 다운받아 설치해야 함으로 해당이 됩니다.
      - 업그레이드, 유지보수가 매우 어려운 단점이 있습니다. 프로그램 수정시 각각의 컴퓨터에 모두 재설치가
        되어야 합니다.

       


   2. WEB(JSP, PHP, ASP, HTML, JavaScript, CSS) 프로그램의 개발 가능
      - 웹 브러우저를 통해서 접근합니다.
      - 사용자는 웹브러우저만 설치되면 별다른 설정 없이 사용이 가능함.
      - 개발자는 유지보수가 매우 편리함.
      - 자바는 JSP 서버 스크립트의 기반 기술로 자바 문법이 그대로 JSP에 사용됩니다.
      - 자바 관련 기술 사용된 사이트
        . 전자 정부, 대법원 등기소, 기상청, 병무청, 고속버스 예매, 철도청,
          대형 쇼핑몰...
        . 일반 중규모 이상의 기업 전산화의 표준 기술
        . 많은 데이터를 처리하기위한 DBMS(Oracle, MS-SQL, MySQL등)가 필요한
          자료처리 분야 

 

   3. 스마트폰 개발분야
      - 안드로이드 폰 개발 언어로 사용.
      - J2ME, WIPI 보다 다양한 고급 개발 API를 제공.
      - 자바 기술중에 IO, Network, XML 관련 기술을 많이 사용.
     


   4. C/C++와의 비교
      - 변수선언, 제어문등 기본적인 구문이 C언어와 같습니다.
      - 객체지향 개념은 C++과 매우 흡사하거나, C++의 기능중에서 일부 다중상속같은 개념은 제거되고 단일상속만 가능등으로 정리되었습니다.
      - 메모리 할당후 메모리 해제 로직을 개발자가 구현해야하나 자바는 VM상에서 자동으로 지원됩니다.
        . stack은 자동으로 복구되나 heap는 메모리 회수를 해주어야 합니다.
      - 자바는 구조체를 사용하지 않습니다.(C, C++, C#에 존재하며 자바 클래스의 어머니입니다.)
      - 공용체 없습니다. (공용체는 C의 운영체제관련 프로그램에서 사용)
      - 자바는 포인터가 없음으로 악의적인 메모리 접근으로 인한 해킹을 피할 수 있습니다.
        . 자바는 모든 기능을 클래스를 이용하며 이 클래스의 객체는 메모리 주소가 아닌 객체의 참조값을 가지고 있습니다.
      - 자바는 자동으로 메모리 회수(Garbage Collection)기능이 있습니다.

      - 사용 분야: 운영 체제, 유틸리티, 드라이버, 네트워크, 게임, 그래픽,
                   임베디드 분야

 


 
[02] JAVA 설치
        - 작업 폴더의 생성:  /home/dev/setup

- project setting
  dev@ubuntu:~$ pwd
  /home/dev
  dev@ubuntu:~$ mkdir setup
  dev@ubuntu:~$ cd setup
  dev@ubuntu:~/setup$ ls -l

 


1. http://java.sun.com에서 ' jdk-6u20-linux-i586.bin' 파일을 '/home/dev/setup'다운.

 

2. 실행 권한 지정

   dev@ubuntu:~/setup$ sudo chmod 755  jdk-6u20-linux-i586.bin

   - 파일명이 실행 할 수 있는 초록색으로 변경됨(permission 변경).
     단 이미 실행권한이 지정되어 있으면 chmod를 실행하지 말것.

 

3. 설치: 현재 경로가 PATH에 등록되어 있지 않음으로 파일 실행시
    현재 폴더가 Path에 등록되어 있지 않음으로 ./로 시작할 것.

dev@ubuntu:~/setup$ cp jdk-6u20-linux-i586.bin /home/dev

dev@ubuntu:~/setup$ cd ..

dev@ubuntu:~$ sudo chmod 755  jdk-6u20-linux-i586.bin

dev@ubuntu:~$ ./jdk-6u20-linux-i586.bin

 


4. path 설정
   - 경로 구분자: ":"
   - 변수명은 $으로 시작
   - 현재 경로 확인
   root@ubuntu:~# pwd
   /home/dev

   - root 권한 획득
   sudo -s

   - 기존 경로의 확인
     echo $PATH

   - 환경 파일 편집
   root@ubuntu:~# gedit .bashrc

   - 아래의 내용을 파일 맨 아래에 추가할것.
export J2RE_HOME=/home/dev/jdk1.6.0_20/jre
export PATH=$PATH:$J2RE_HOME/bin

JAVA_HOME=/home/dev/jdk1.6.0_20
export PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=.:$JAVA_HOME/jre/lib/*

   - 변경된 소스 적용
   source .bashrc

   - gedit 닫기

 

 
6. 새로운 터미널을 열어 확인 합니다.
   java -version

   javac

 


7. .bashrc 파일 전체 내용

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
 # We have color support; assume it's compliant with Ecma-48
 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
 # a case would tend to support setf rather than setaf.)
 color_prompt=yes
    else
 color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

export J2RE_HOME=/home/dev/jdk1.6.0_20/jre
export PATH=$PATH:$J2RE_HOME/bin

JAVA_HOME=/home/dev/jdk1.6.0_20
export PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=.:$JAVA_HOME/jre/lib/*

 

 

Posted by ▶파이팅◀

블로그 이미지
Let's start carefully from the beginning
▶파이팅◀

태그목록

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

최근에 올라온 글

최근에 달린 댓글

글 보관함