2012年3月3日 星期六

Ubuntu安裝桌面捷徑工具

Ubuntu11.10拿掉了原本的的右鍵建立捷徑,可參考下列方式使用


安裝
sudo apt-get install --no-install-recommends gnome-panel


使用方法
gnome-desktop-item-edit ~/Desktop/ --create-new


ubuntu 新增啟動圖示

OS Ubuntu 10.04


Step1.新增啟動圖示
  • 滑鼠右鍵→新增啟動圖示
Step2.欄位輸入數值 (這裡使用Eclipse作為範例)

  • 類型:應用程式
  • 名稱:eclipse
  • 指令:/opt/eclipse/eclipse











若你想改變ICON點擊圖片即可,然後選擇你想要用的ICON檔案。
eclipse可以使用eclipse資料夾裡的icon.xpm。

Ubuntu 安裝 MySQL的JDBC


※apt安裝方式會自動把環境改成openJDK


Step1.先升級套件
  • sudo apt-get update
Step2.安裝MySQL JDBC
  • sudo apt-get install libmysql-java
Step3.設定環境變數

你可以設定在全體環境的/etc/profile或是個別使用者的/home/[user]/.bashrc。
  • sudo gedit /etc/profile
加入以下文字:
#MySQL JDBC environment
export CLASSPATH=$CLASSPATH:/usr/share/java/mysql.jar

Step4.載入新的環境變數設定

  • source /etc/profile
Step5.看看現在的CLASSPATH
  • echo $CLASSPATH
Step6.寫一個JAVA程式測試看看JDBC
package com.jt;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class DBDemo
{

private static final String driver = "com.mysql.jdbc.Driver";
private static final String url = "jdbc:mysql://127.0.0.1";
private static final String username = "yourDB_username";
private static final String password = "yourDB_password";

/**
* @param args
*/
public static void main(String[] args) throws ClassNotFoundException,SQLException
{
      Connection conn;
      Class.forName(driver);
      conn = DriverManager.getConnection(url, username, password);
      System.out.println("Success");
      conn.close();
}
}

記得在eclipse中要把JDBC的jar給加進來
  • Select Project Properties > Java Build Path
  • Select Libries tab
  • Click Add External Jars
  • Choose the jar file, /usr/share/java/mysql.jar














加進來後可以看到:













參考資料:
安裝說明:

關於Linux 環境變數 profile

  • /etc/profile:全體使用者都會套用的環境變數(只有管理者可修改)。
  • ~/.bashrc:個體用戶的環境變數,若此處有與/etc/profile相同選項設定,將會蓋過設定,bashrc是隱藏檔,須使用ls -a即可看見。

參考與引用資料:
http://kalug.linux.org.tw/~lloyd/LLoyd_Hand_Book/book/bash-edit-profile.html

http://alex.obm.tw/cn/forum/%E9%97%9C%E6%96%BCubuntu9.04%E9%96%8B%E6%A9%9F%E6%AA%94%E6%A1%88rc.local%E3%80%81/etc/bash.bashrc%E3%80%81/bashrc-/etc/profile-/.profile

64bit Linux 想使用32bit環境

If you are running a 64-bit distribution on your development machine, you need to install the ia32-libs package using apt-get:: 

  • sudo apt-get install ia32-libs

在64bit linux下開發 android 會使用到,android目前開發環境是32bit

Android Linux開發環境配置(Old)

Android Linux開發環境配置  (舊文章整合筆記)
本文撰寫時,SDK的最新版本是3.0,ADT為r10。
需要項目
※目前版本的android SDK下載改成由android ADV Manager 來管理下載,
而不是直接下載SDK。




※請先配置好JDK與Eclipse請參考以下連結

Linux JDK配置。
Linux Sun JDK
Windwos JDK配置。
Linux Eclipse 配置。
Windows Eclipse配置。


android配置項目
a.下載SDK package
b.設定android SDK環境變數
c.安裝ADT
d.利用ADV下載android的SDK與開發工具。

詳細步驟
Step1.下載SDK package
//這個SDK package類含ADV Manager,下載完畢後會使用這個ADV來更新最新的SDK。
Ubuntu中FrieFox下載完後會再home的DownLoad裡。

Step2.解開SDK Package
  • tar xzf android-sdk_r10-linux_x86.tgz
使用桌面環境直接點擊解壓,或是使用命令模式解壓。

Step3.將解開後資料夾移到你習慣的資料夾
//suod mv [原本資料夾]  [目的資料夾]
sudo mv  [原本SDK資料夾]   /opt/androidSDK

Step4.SDK Package 環境變數設定
  • sudo gedit /etc/profile
於原本PATH中加入SDK Package的所在路徑如下:
    export PATH=${PATH}:<your_sdk_dir>/tools

Step5.Ubuntu 10.4 64bit
在64bit環境要使用32bit的android開發需要執行以下命令
If you are running a 64-bit distribution on your development machine, you need to install the ia32-libs package using apt-get::
  • sudo apt-get install ia32-libs

Step6.安裝ADT
  • Start Eclipse, then select Help > Install New Software...
  • Click Add, in the top-right corner.
  • In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: 
https://dl-ssl.google.com/android/eclipse/
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
Click OK.

  • In the Available Software dialog, select the checkbox next to Developer Tools and click Next
  • In the next window, you'll see a list of the tools to be downloaded. Click Next
  • Read and accept the license agreements, then click Finish.
  • When the installation completes, restart Eclipse.

  • Eclipse中選Help > Install New Software 以便安裝ADT
  • 點擊ADD
  • Name 欄中輸入ADT Plugin ,Location欄中輸入 https (如果你https無法使用可以改成http)://dl-ssl.google.com/android/eclipse/
  • 接著一直Next到Finish之後重開Eclipse
  • Step7.ADT  Configuring (ADT的配置)
    1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
    2. Select Android from the left panel.
    3. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
    4. Click Apply, then OK.
    Step8.平台的其他部件增加
  • From within Eclipse, select Window > Android SDK and AVD Manager.
  • On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:
    android
  • 可以從Eclipse選項中 選 Window > Android SDK and AVD Manager   Or 或是直接從android SDK package解壓後所在直接執行 android
    執行完出現
    選擇你要安專的項目,請參考 http://developer.android.com/sdk/installing.html#which 之後就可以開始來寫個Hello World了哈~ 參考文件 SDK Install 官方文件 ADT install 官方文件

VMware6 Linux系統時間不同步解決

Step1.更新套件
  • sudo apt-get update
Step2.
  • sudo apt-get install open-vm-tools
Step3.
  • sudo apt-get install open-vm-dkms
Step4.
  • sudo apt-get install open-vm-source
Step5.
  • sudo apt-get install open-vm-toolbox

Step6.開啟 vm-tools
  • vmware-toolbox
Step7.Options tag下,將Time Synchronization between the virtual machine and the host operation system.選項打勾。



參考資料與引用