Cài đặt Eclipse 4.2 Juno trên Ubuntu 12.04
Như các bạn đã biết eclipse là một trong những công cụ rất mạnh để lập trình java trên môi trường Windows lẫn Linux. Hỗ trợ nhiều plug-in để lập trình: Android SDK, Windows phone SDK, C/C++...
Để tiến hành cài đặt offline theo cách mình sắp trình bày này các bạn cần truy tải về gói cài đặt tai: Eclipse Juno
Sau khi tải về nó nằm ở thu mục /home/Downloads. Các bạn copy ra thư mục home để làm việc.
Bước 1: Di chuyển gói cài đặt Eclipse Juno 4.2 vào thư mục /opt:
# sudo mv eclipse-SDK-4.2.1-linux-gtk.ta r.gz /opt/
Bước 2: Tiến hành giải nén với câu lệnh sau:
# cd /opt/
# sudo tar xzvf eclipse-SDK-4.2.1-linux-gtk.ta r.gz
Bước 3: Tại tệp tin desktop và đặt nó vào trong /usr/share/applications.
# sudo gedit /usr/share/applications/ eclipse.desktop
Chép nội dung sau vào tệp tin desktop:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop
Bước 4: Kéo thả biểu tượng Eclipse từ /usr/share/applications/ eclipse.desktop vào thanh Dashbar để dễ dàng làm việc.
Chúc các bạn thành công!
Cài đặt trình biên dịch C/C++
Trình biên dịch trong Ubuntu của C là gcc, của C++ là g++. Để cài đặt bạn mở Terminal rồi gõ:
sudo apt-get install gcc (đối với C)
hoặc: sudo apt-get install g++ (đối với C++)
Sau đó gõ tiếp:
sudo apt-get install build-essential
để cài đặt các thư viện, hay các thành phần cần thiết khác.
Tiếp theo là biên dịch file bạn vừa soạn thảo. Vào Terminal gõ:
gcc “file name”.c -o “file name” (đối với C)
hoặc: g++ “file name”.c -o “file name” (đối với C++)
“file name” ở đây là tên file mà bạn vừa lưu ở trên. Câu lệnh này để biên dịch ra file chạy từ file bạn vừa soạn thảo nếu chương trình không có lỗi gì, còn nếu có lỗi thì sẽ được hiện ra trong cửa sổ terminal. Để chạy chương trình bạn gõ tiếp:
./”file name”
Cài C++ cho Eclipse
Bước 1: Vào Ubuntu Software Center, tìm Eclipse
Bước 2: Cài đặt Eclipse
Bước 3: Khởi động Eclipse, vào Help/Install new software
Bước 4: Trong cửa sổ hiện ra nhấn Add, sau đó điền thông tin như sau:
- Name: CDT
- Location: http://download.eclipse.org/tools/cdt/releases/juno
Nhấn OK, sau đó trong mục CDT Main feature bạn chọn Eclipse C/C++ development tools
- Nhấn Next và trải qua vài thủ tục cho đến khi quá trình cài đặt hoàn tất.
Bước 5: Khởi động lại Eclipse và bạn đã có thể lập trình C/C++
Cài Font Windows cho Ubuntu (Copy bằng tay)
Thư mục Fonts cua Ubuntu là /usr/share/fonts/truetype/ bạn chỉ cần copy các Fonts của Windows vào thư mục này.
Cách thực hiện như sau: (Mở Terminal lên)
- Vào thư mục Fonts Windows: cd /media/guru/WINDOWS/Fonts
- Copy vào thư mục Fonts Ubuntu: sudo cp * /usr/share/fonts/truetype/
Cài đặt gõ tiếng Việt Unikey
- Mở Terminal chạy dòng lệnh: sudo apt-get install ibus-unikey
- Vào Language Support, mục Keyboard input method system chọn IBus
- Vào Keyboard Input Methods/Input Method chọn Customize active input methods, thẻ Select an input method mục Vietnamese chọn Unikey
- Chuyển qua thẻ Advanced chọn Share the same input method among all applications
- Nhấn tổ hợp phím Ctrl + Space để gõ tiếng Việt.
Source: http://laptrinh.x10.mx/blog/2013/05/lap-trinh-cc-tren-ubuntu-13-04/
Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS
Introduction
The first question is why are we installing an old JDK. The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4).
This is an update to an older version of this post. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4 .
Install Java
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS.
Download the Java JDK fromhttp://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u31-oth-JPR .
Click Accept License Agreement
Click jdk-6u31-linux-x64.bin
Login to Oracle.com with your Oracle account
Download the JDK to your ~/Downloads directory
After downloading, open a terminal, then enter the following commands.
cd ~/Downloads
chmod +x jdk-6u31-linux-x64.bin
./jdk-6u31-linux-x64.bin
Note:
The jvm directory is used to organize all JDK/JVM versions in a single parent directory.
sudo mkdir /usr/lib/jvm
sudo mv jdk1.6.0_31 /usr/lib/jvm
The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme.
sudo update-alternatives --install "/usr/bin/java" "java" \
"/usr/lib/jvm/jdk1.6.0_31/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" \
"/usr/lib/jvm/jdk1.6.0_31/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" \
"/usr/lib/jvm/jdk1.6.0_31/bin/javaws" 1
sudo update-alternatives --config java
You will see output similar to the following (although it’ll differ on your system). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.6.0_26/bin/java)
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 auto mode
1 /usr/lib/jvm/jdk1.6.0_31/bin/java 1 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
On my system I did the following (change the number that is appropriate for your system):
Press 1 on your keyboard, then press Enter.
sudo update-alternatives --config javac
Follow steps similar to those listed above if you are presented with a list of options. In my case, I had not previously installed the OpenJDK javac binary, so my output looked like the following:
There is only one alternative in link group javac: /usr/lib/jvm/jdk1.6.0_31/bin/javac
Nothing to configure.
sudo update-alternatives --config javaws
As with javac, I did not have the OpenJDK version of javaws installed, so my output was simple. However, if you get a list of options, just type in the number of the path to the Oracle javaws command, and press Enter.
There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.6.0_31/bin/javaws
Nothing to configure.
As a final step, let’s test each of the commands to ensure everything is setup correctly.
java -version
The output should be:
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
javac -version
The output should be:
javac 1.6.0_31
javaws -version
The output should be:
Java(TM) Web Start 1.6.0_31
which is followed by a long usage message.
Create the JAVA_HOME environment variable
Open a terminal, then enter the following commands:
sudo vi /etc/environment
WARNING
WordPress displays the quotes around the JAVA_HOME value below as magic quotes. This will cause problems when you try to use your JVM in certain applications.
Do not copy/paste the JAVA_HOME value below. Or if you do, ensure that you change magic quotes to straight quotes in your editor.
Enter the following at the bottom of the file:
JAVA_HOME="/usr/lib/jvm/jdk1.6.0_31"
Type the following commands to finish the setup and verify that everything is setup correctly.
source /etc/environment
echo $JAVA_HOME
You should see the following output:
/usr/lib/jvm/jdk1.6.0_31
Lastly, verify that JAVA_HOME is set correctly for the sudo user:
sudo env | grep JAVA_HOME
That’s it, the JDK 6.0 update 31 is installed.
Như các bạn đã biết eclipse là một trong những công cụ rất mạnh để lập trình java trên môi trường Windows lẫn Linux. Hỗ trợ nhiều plug-in để lập trình: Android SDK, Windows phone SDK, C/C++...
Để tiến hành cài đặt offline theo cách mình sắp trình bày này các bạn cần truy tải về gói cài đặt tai: Eclipse Juno
Sau khi tải về nó nằm ở thu mục /home/Downloads. Các bạn copy ra thư mục home để làm việc.
Bước 1: Di chuyển gói cài đặt Eclipse Juno 4.2 vào thư mục /opt:
# sudo mv eclipse-SDK-4.2.1-linux-gtk.ta
Bước 2: Tiến hành giải nén với câu lệnh sau:
# cd /opt/
# sudo tar xzvf eclipse-SDK-4.2.1-linux-gtk.ta
Bước 3: Tại tệp tin desktop và đặt nó vào trong /usr/share/applications.
# sudo gedit /usr/share/applications/
Chép nội dung sau vào tệp tin desktop:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop
Bước 4: Kéo thả biểu tượng Eclipse từ /usr/share/applications/
Chúc các bạn thành công!
Cài đặt trình biên dịch C/C++
Trình biên dịch trong Ubuntu của C là gcc, của C++ là g++. Để cài đặt bạn mở Terminal rồi gõ:
sudo apt-get install gcc (đối với C)
hoặc: sudo apt-get install g++ (đối với C++)
Sau đó gõ tiếp:
sudo apt-get install build-essential
để cài đặt các thư viện, hay các thành phần cần thiết khác.
Tiếp theo là biên dịch file bạn vừa soạn thảo. Vào Terminal gõ:
gcc “file name”.c -o “file name” (đối với C)
hoặc: g++ “file name”.c -o “file name” (đối với C++)
“file name” ở đây là tên file mà bạn vừa lưu ở trên. Câu lệnh này để biên dịch ra file chạy từ file bạn vừa soạn thảo nếu chương trình không có lỗi gì, còn nếu có lỗi thì sẽ được hiện ra trong cửa sổ terminal. Để chạy chương trình bạn gõ tiếp:
./”file name”
Cài C++ cho Eclipse
Bước 1: Vào Ubuntu Software Center, tìm Eclipse
Bước 2: Cài đặt Eclipse
Bước 3: Khởi động Eclipse, vào Help/Install new software
Bước 4: Trong cửa sổ hiện ra nhấn Add, sau đó điền thông tin như sau:
- Name: CDT
- Location: http://download.eclipse.org/tools/cdt/releases/juno
Nhấn OK, sau đó trong mục CDT Main feature bạn chọn Eclipse C/C++ development tools
- Nhấn Next và trải qua vài thủ tục cho đến khi quá trình cài đặt hoàn tất.
Bước 5: Khởi động lại Eclipse và bạn đã có thể lập trình C/C++
Cài Font Windows cho Ubuntu (Copy bằng tay)
Thư mục Fonts cua Ubuntu là /usr/share/fonts/truetype/ bạn chỉ cần copy các Fonts của Windows vào thư mục này.
Cách thực hiện như sau: (Mở Terminal lên)
- Vào thư mục Fonts Windows: cd /media/guru/WINDOWS/Fonts
- Copy vào thư mục Fonts Ubuntu: sudo cp * /usr/share/fonts/truetype/
Cài đặt gõ tiếng Việt Unikey
- Mở Terminal chạy dòng lệnh: sudo apt-get install ibus-unikey
- Vào Language Support, mục Keyboard input method system chọn IBus
- Vào Keyboard Input Methods/Input Method chọn Customize active input methods, thẻ Select an input method mục Vietnamese chọn Unikey
- Chuyển qua thẻ Advanced chọn Share the same input method among all applications
- Nhấn tổ hợp phím Ctrl + Space để gõ tiếng Việt.
Source: http://laptrinh.x10.mx/blog/2013/05/lap-trinh-cc-tren-ubuntu-13-04/
Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS
Introduction
The first question is why are we installing an old JDK. The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4).
This is an update to an older version of this post. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4 .
Install Java
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS.
Download the Java JDK fromhttp://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u31-oth-JPR .
Click Accept License Agreement
Click jdk-6u31-linux-x64.bin
Login to Oracle.com with your Oracle account
Download the JDK to your ~/Downloads directory
After downloading, open a terminal, then enter the following commands.
cd ~/Downloads
chmod +x jdk-6u31-linux-x64.bin
./jdk-6u31-linux-x64.bin
Note:
The jvm directory is used to organize all JDK/JVM versions in a single parent directory.
sudo mkdir /usr/lib/jvm
sudo mv jdk1.6.0_31 /usr/lib/jvm
The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme.
sudo update-alternatives --install "/usr/bin/java" "java" \
"/usr/lib/jvm/jdk1.6.0_31/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" \
"/usr/lib/jvm/jdk1.6.0_31/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" \
"/usr/lib/jvm/jdk1.6.0_31/bin/javaws" 1
sudo update-alternatives --config java
You will see output similar to the following (although it’ll differ on your system). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.6.0_26/bin/java)
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 auto mode
1 /usr/lib/jvm/jdk1.6.0_31/bin/java 1 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
On my system I did the following (change the number that is appropriate for your system):
Press 1 on your keyboard, then press Enter.
sudo update-alternatives --config javac
Follow steps similar to those listed above if you are presented with a list of options. In my case, I had not previously installed the OpenJDK javac binary, so my output looked like the following:
There is only one alternative in link group javac: /usr/lib/jvm/jdk1.6.0_31/bin/javac
Nothing to configure.
sudo update-alternatives --config javaws
As with javac, I did not have the OpenJDK version of javaws installed, so my output was simple. However, if you get a list of options, just type in the number of the path to the Oracle javaws command, and press Enter.
There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.6.0_31/bin/javaws
Nothing to configure.
As a final step, let’s test each of the commands to ensure everything is setup correctly.
java -version
The output should be:
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
javac -version
The output should be:
javac 1.6.0_31
javaws -version
The output should be:
Java(TM) Web Start 1.6.0_31
which is followed by a long usage message.
Create the JAVA_HOME environment variable
Open a terminal, then enter the following commands:
sudo vi /etc/environment
WARNING
WordPress displays the quotes around the JAVA_HOME value below as magic quotes. This will cause problems when you try to use your JVM in certain applications.
Do not copy/paste the JAVA_HOME value below. Or if you do, ensure that you change magic quotes to straight quotes in your editor.
Enter the following at the bottom of the file:
JAVA_HOME="/usr/lib/jvm/jdk1.6.0_31"
Type the following commands to finish the setup and verify that everything is setup correctly.
source /etc/environment
echo $JAVA_HOME
You should see the following output:
/usr/lib/jvm/jdk1.6.0_31
Lastly, verify that JAVA_HOME is set correctly for the sudo user:
sudo env | grep JAVA_HOME
That’s it, the JDK 6.0 update 31 is installed.
No comments:
Post a Comment