網頁

顯示具有 Eclipse 標籤的文章。 顯示所有文章
顯示具有 Eclipse 標籤的文章。 顯示所有文章

2020年3月23日 星期一

ubuntu eclipse install

參考 Ubuntu 1804 桌面版 Eclipse + JSP 學習記錄
$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:
$ vi ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export CLASSPATH=.:${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}
$ source ~/.bashrc
到網頁 https://www.eclipse.org/
找到要下載的 linux 64 bit 版本 https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-03/R/eclipse-inst-linux64.tar.gz
$ cd Downloads/
$ tar xvf eclipse-inst-linux64.tar.gz
$ cd eclipse-installer/
為避免
Caused by: java.io.FileNotFoundException: /home/user1/Downloads/eclipse-installer/configuration/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
$ sudo chown -RH mark: configuration/
有人使用 $ sudo ./eclipse-inst, 但安裝完成後,只能用 $ sudo ./eclipse 啟動
$ ./eclipse 會出現 /root/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linuxx86_64.1.1.1100.v20190907-0426: cannot open shared object file: Permission denied
$ ./eclipse-inst
選擇 Eclipse IDE for Enterprise Java Developers
選擇 java 版本和安裝路徑
$ sudo rm -rf eclipse-installer/ eclipse-inst-linux64.tar.gz
$ cd

安裝桌面啟動捷徑
$ vi ~/.local/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=/home/user1/eclipse/jee-2020-03/eclipse/icon.xpm
Exec=/home/user1/eclipse/jee-2020-03/eclipse/eclipse
Terminal=false
Categories=Development
StartupWMClass=Eclipse

$ chmod +x ~/.local/share/applications/eclipse.desktop
重新開機
按 Search, 找 Eclipse, 按右鍵, Add to Favorites

Eclipse 設定 Tomcat server
$ wget http://ftp.tc.edu.tw/pub/Apache/tomcat/tomcat-9/v9.0.33/bin/apache-tomcat-9.0.33.tar.gz
$ tar xvf apache-tomcat-9.0.33.tar.gz
開啟 eclipse
Window/Preferences
Server/Runtime Environment
按 Add, 選擇 Apache Tomcat v9.0
設定 Tomcat installation directory: 到剛才解壓縮的路徑
Window/Show View/Other...
選擇 Servers
按 ProjectExplorer/Servers/Tomcat v9.0 Server at localhost-config/server.xml
修改 port

建立 Eclipse 專案
File/New/Dynamic Web Project
輸入專案名稱
在 Web Module 頁中,將 Generate web.xml deployment descriptor 打勾
Project Explorer/專案名稱/WebContent 右鍵 New/JSP File

下載 gson-2.8.6.jar 到 專案下的 WEB-INF/lib 下


處理 json

Project Explorer/專案名稱 右鍵 Export/WAR file

2018年4月28日 星期六

Kennel 升級紀錄

Windows 10 回復原廠設定不能使用
出現 "重設您的電腦時發生問題 沒有做任何變更"
官方網站下載 Windows 10
此時會有兩種選項,一是升級本身的電腦,二是建立安裝媒體(USB 隨身碟 8G)
兩者皆有測試過
似乎授權已經寫入 BIOS, 所以即使換硬碟重灌也可以直接啟用

部分的硬碟分割區無法刪除
需用 命令題是字元 執行 diskpart
DISKPART> list disk
DISKPART> select disk 1
DISKPART> list disk
DISKPART> list partition
DISKPART> clean

資料庫使用
mariadb-10.2.14-winx64.msi
備份使用
dump.bat
@echo off
set dt=%date:~0,10%
rem date format is "YYYY-MM-DD"
set dy=%dt:~0,4%
set dm=%dt:~5,2%
set dd=%dt:~8,2%
rem echo %dt%
set TODAY=%dy%%dm%%dd%
dump.bat
call today.bat
"c:\Program Files\MariaDB 10.2\bin\mysqldump.exe" -u root -pmark1234 -B kennel util>mariadb_%today%.sql
"c:\Program Files\7-Zip\7z.exe" a -tzip mariadb_%today%.sql.zip mariadb_%today%.sql
del mariadb_%today%.sql


開發環境使用
jdk-8u172-windows-i586.exe (給舊的 Eclipse 3 使用 32位元環境)
jdk-8u172-windows-x64.exe
eclipse-jee-oxygen-3a-win32-x86_64.zip
External JARs 換位置了,之前可以隨便放,現在必須放在 WEB-INF\lib
否則程式執行時會發生 ClassNotFoundException
使用 Tomcat v9.0 搭配 java 10 時,發生
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 9.0\endorsed is not supported.
錯誤,即使將 Run/Debug Configurations/Arguments/VM arguments 內的
-Djava.endorsed.dirs="C:\Program Files\Apache Software Foundation\Tomcat 9.0\endorsed"
刪除,下次執行時,依舊又出現,換成舊版的 java 即可解決

網站使用
apache-tomcat-9.0.7.exe (不能搭配 java 10)
修改 config 下的 server.xml 和 context.xml 請注意權限
若不修改權限,作業系統會搞鬼,讓你以為修改成功,浪費時間抓蟲
Tomcat v6.0 時, server.xml 為
<Context docBase="Main" path="/Kennel" reloadable="true" source="org.eclipse.jst.jee.server:Main">
<Resource name="jdbc/MainDS" auth="Container" type="javax.sql.DataSource" maxActive="4" maxIdle="2" maxWait="4" username="xxxx" password="xxxx" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/?useUnicode=true&amp;amp;characterEncoding=big5"></Resource></Context>

Tomcat v9.0 時, server.xml 不用動, 反而是修改 context.xml
    <Resource 
    name="jdbc/MainDS" 
    auth="Container" 
    type="javax.sql.DataSource" 
    maxTotal="4" 
    maxIdle="2" 
    maxWaitMillis="-1" 
    username="xxxx" 
    password="xxxx" 
    driverClassName="org.mariadb.jdbc.Driver" 
    url="jdbc:mariadb://localhost:3306/?useUnicode=true&amp;characterEncoding=utf8">
    </Resource>
注意其中 maxActive 改成 maxTotal, maxWait 變成 maxWaitMillis
另外 DBCP 也有變化,由
<Resource
    name="jdbc/MainDb"
    scope="Shareable"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    maxTotal="4" maxIdle="2" maxWaitMillis="-1"
    url="jdbc:mariadb://localhost:3306"
    driverClassName="org.mariadb.jdbc.Driver"
    username="xxxx"
    password="xxxx"
    />
變成
<Resource
    name="jdbc/MainDb"
    scope="Shareable"
    type="javax.sql.DataSource"
    factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
    maxTotal="4" maxIdle="2" maxWaitMillis="-1"
    url="jdbc:mariadb://localhost:3306"
    driverClassName="org.mariadb.jdbc.Driver"
    username="xxxx"
    password="xxxx"
    />







2015年2月6日 星期五

AVD 的鍵盤輸入

進 Eclipse 點 Window/Android Virtual Device Manager
編輯虛擬機器之 Keyboard 設定
勾選 Hardware keyboard present:使用開發機器的實體鍵盤
  可方便輸入英文和符號,但無法使用中文
  原本要按 Shift 的要加按 Alt
取消勾選 Hardware keyboard present:使用Android的鍵盤
  可安裝中文輸入法,但很難操作

下載adnroid注音輸入法

安裝輸入法
C:\eclipse4_64\android-sdk-windows\platform-tools>adb install ZhuYinIME_2010030801.apk
1101 KB/s (1012516 bytes in 0.897s)
        pkg: /data/local/tmp/ZhuYinIME_2010030801.apk
Success

設定輸入法
設定/語言與輸入設定/勾選注音輸入法

點選 edittext 時還是出現英文鍵盤
常按英文鍵盤的空白鍵,此時跳出輸入法切換,選擇注音輸入法
若要回復成英文鍵盤,還是要回設定取消勾選注音輸入法

adnroid adb

查詢連接的裝置
C:\eclipse4_64\android-sdk-windows\platform-tools>adb devices
List of devices attached
emulator-5554   deviceadb shell
指定一台下命令
C:\eclipse4_64\android-sdk-windows\platform-tools>adb -s emulator-5554 shell
root@android:/ #

查詢網路裝置
C:\eclipse4_64\android-sdk-windows\platform-tools>adb shell netcfg
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:
00:00:00
eth0     UP                                   10.0.2.15/24  0x00001043 52:54:00:
12:34:56
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:
00:00:00

查詢網路裝置設定
C:\eclipse4_64\android-sdk-windows\platform-tools>adb shell ifconfig eth0
eth0: ip 10.0.2.15 mask 255.255.255.0 flags [up broadcast running multicast]

測試網路
C:\eclipse4_64\android-sdk-windows\platform-tools>adb shell ping -c 3 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.310 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.616 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.338 ms
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 0.310/0.421/0.616/0.139 ms
好像只能用在 localhost 127.0.0.1 10.0.2.2
發現採用 nc(netcat) 命令才可
C:\eclipse4_64\android-sdk-windows\platform-tools>adb shell nc -v www.google.com 80
Connection to www.google.com 80 port [tcp/www] succeeded!
C:\eclipse4_64\android-sdk-windows\platform-tools>adb shell nc -v 192.168.1.72 8080
Connection to 192.168.1.72 8080 port [tcp/webcache] succeeded!


2015年2月4日 星期三

開啟 https,使用 openssl CA

建立CA私鑰
D:\EclipseAndroid\Web>openssl genrsa -out cakey.pem 2048
查看公鑰
D:\EclipseAndroid\Web>openssl rsa -in cakey.pem -pubout -text
生成自簽證書
D:\EclipseAndroid\Web>set OPENSSL_CONF=c:\Program Files (x86)\GnuWin32\share\openssl.cnf
D:\EclipseAndroid\Web>openssl req -new -x509 -key cakey.pem -out cacert.pem -days 3650
Loading 'screen' into random state - done
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:TW
State or Province Name (full name) [Some-State]:Taiwan
Locality Name (eg, city) []:Taichung
Organization Name (eg, company) [Internet Widgits Pty Ltd]:R&D
Organizational Unit Name (eg, section) []:Mark Chen
Common Name (eg, YOUR name) []:Mark Chen
Email Address []:ingrenn@yahoo.com.tw
D:\EclipseAndroid\Web>mkdir demoCA
D:\EclipseAndroid\Web>mkdir demoCA\private
D:\EclipseAndroid\Web>mkdir demoCA\newcerts
在 demoCA 目錄下建立文字檔 index.txt
在 demoCA 目錄下建立文字檔 serial,內容 "00"
D:\EclipseAndroid\Web>copy cakey.pem demoCA\private
D:\EclipseAndroid\Web>copy cacert.pem demoCA
建立給 tomcat 使用的私鑰
D:\EclipseAndroid\Web>openssl genrsa -out tomcat.key 1024
tomcat 客戶端生成證書簽屬請求
D:\EclipseAndroid\Web>openssl req -new -key tomcat.key -out tomcat.csr
Loading 'screen' into random state - done
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:TW
State or Province Name (full name) [Some-State]:Taiwan
Locality Name (eg, city) []:Taichung
Organization Name (eg, company) [Internet Widgits Pty Ltd]:R&D
Organizational Unit Name (eg, section) []:Mark Chen
Common Name (eg, YOUR name) []:localhost因為在本機使用,正式須如:www.domain.com
Email Address []:ingrenn@localhost

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:不要打密碼,不然會失敗
An optional company name []:
D:\EclipseAndroid\Web>openssl ca -in tomcat.csr -out tomcat.crt -days 3655
D:\EclipseAndroid\Web>openssl pkcs12 -export -in tomcat.crt -inkey tomcat.key -out tomcat.p12
Loading 'screen' into random state - done
Enter Export Password:在 tomcat 的 server.xml 設定中要用
Verifying - Enter Export Password:

在 tomcat 的 server.xml 設定中
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
  maxThreads="150" scheme="https" secure="true"
  clientAuth="false" sslProtocol="TLS"
  keystoreFile="D:\EclipseAndroid\Web\tomcat.p12"
  keystoreType="pkcs12" keystorePass="changit"
/>


開啟 IE /網際網路選項/內容/憑證/受信任的跟憑證授信單位/匯入 cacert.pem

如果要將 http 自動轉成 https,在 web.xml 的 <web-app> 中加入下列設定
<!-- Require HTTPS for everything except /img (favicon) and /css. -->
<security-constraint>
  <web-resource-collection>
    <web-resource-name>HTTPSOnly</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>
<security-constraint>
  <web-resource-collection>
    <web-resource-name>HTTPSOrHTTP</web-resource-name>
    <url-pattern>*.ico</url-pattern>
    <url-pattern>/img/*</url-pattern>
    <url-pattern>/css/*</url-pattern>
  </web-resource-collection>
  <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
  </user-data-constraint>
</security-constraint>


android 安裝證書
1. copy cakey.pem cakey.cer
2. 將 cakey.cer 證書放到 /storage/sdcard0/Download
3. 設定/安全性/從手機儲存空間安裝


開啟 https

在 命令提示字元下
>"c:\Program Files\Java\jre7\bin\keytool.exe" -genkeypair -alias tomcat -keyalg RSA -keystore keystore.pfx -storetype pkcs12
您的名字與姓氏為何?
  [localhost]:
您的組織單位名稱為何?
  [R&D]:
您的組織名稱為何?
  [Mark Chen]:
您所在的城市或地區名稱為何?
  [tw]:  Taichung
您所在的州及省份名稱為何?
  [taiwan]:
此單位的兩個字母國別代碼為何?
  [tw]:
CN=localhost, OU=R&D, O=Mark Chen, L=Taichung, ST=taiwan, C=tw 正確嗎?


在 tomcat 的 server.xml 中
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
        maxThreads="150" scheme="https" secure="true"
        clientAuth="false" sslProtocol="TLS"
        keystoreFile="D:\EclipseAndroid\Web\keystore.pfx"
        keystoreType="pkcs12" keystorePass="mark1234"
        />

開啟 IE /網際網路選項/內容/憑證/個人/匯入 keystore.pfx


您的名字與姓氏為何?即是CN
其內容必須是網域名稱如 www.host.com.tw 或 localhost

使用 -storetype pkcs12 否則 IE 無法匯入憑證


2015年2月3日 星期二

Eclipse 加入 Web 開發

1. 開啟 Eclipse
2. Menu/Help/Install New Software
3. 選擇 Luna - http://download.eclipse.org/releases/luna
4. 勾選 Web, XML, Java EE and OSGi Enterprise Development
5. 重開 Eclipse
6. Menu/Windows/Preference
7. 選 Server/Runtime Environments, 選擇 Add
8. 選 Apache/Apache Tomcat v6.0
9. 按 Next 設定 Tomcat 安裝路徑
10. New Project 時,選擇 Web/Dynamic Web Project

2014年11月28日 星期五

ScreenOff 一鍵鎖屏

在 Activity 中
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
pm.goToSleep(SystemClock.uptimeMillis());
在 AndroidManifest.xml 中
<uses-permission android:name="android.permission.DEVICE_POWER"/>
失敗


在 Activity 中
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "GoToSleep");
wl.acquire();
wl.release();
在 AndroidManifest.xml 中
<uses-permission android:name="android.permission.DEVICE_POWER"/>
失敗


在 Activity 中
WindowManager.LayoutParams params = getWindow().getAttributes();
params.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON;
params.screenBrightness = 0;
getWindow().setAttributes(params);
成功 但只是螢幕切暗


在 Activity 中
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
mPowerManager = (PowerManager)getSystemService(POWER_SERVICE);
mWindowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
mWindowManager.getDefaultDisplay();
mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass().getName());
在 protected void onResume() 中
mWakeLock.acquire();
在 protected void onPause() 中
mWakeLock.release();
在 AndroidManifest.xml 中
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.HARDWARE_TEST" />
失敗


2014年11月27日 星期四

控制 Eclipse 的虛擬機器

可以直接使用鍵盤輸入資料
需要用Shift才可鍵入的字元需要加按Alt

Home -> Home
Esc -> Back
F2 -> Menu
F3 -> 撥號鍵
F4 -> 掛斷鍵
F5 -> 搜尋鍵
F8 -> 網路開關
Ctrl+F11 -> 旋轉螢幕

adb shell input keyevent 26

0 -> "KEYCODE_UNKNOWN"
1 -> "KEYCODE_MENU" 
2 -> "KEYCODE_SOFT_RIGHT" 
3 -> "KEYCODE_HOME" 
4 -> "KEYCODE_BACK" 
5 -> "KEYCODE_CALL" 
6 -> "KEYCODE_ENDCALL" 
7 -> "KEYCODE_0" 
8 -> "KEYCODE_1" 
9 -> "KEYCODE_2" 
10 -> "KEYCODE_3" 
11 -> "KEYCODE_4" 
12 -> "KEYCODE_5" 
13 -> "KEYCODE_6" 
14 -> "KEYCODE_7" 
15 -> "KEYCODE_8" 
16 -> "KEYCODE_9" 
17 -> "KEYCODE_STAR" 
18 -> "KEYCODE_POUND" 
19 -> "KEYCODE_DPAD_UP" 
20 -> "KEYCODE_DPAD_DOWN" 
21 -> "KEYCODE_DPAD_LEFT" 
22 -> "KEYCODE_DPAD_RIGHT" 
23 -> "KEYCODE_DPAD_CENTER" 
24 -> "KEYCODE_VOLUME_UP" 
25 -> "KEYCODE_VOLUME_DOWN" 
26 -> "KEYCODE_POWER" 
27 -> "KEYCODE_CAMERA" 
28 -> "KEYCODE_CLEAR" 
29 -> "KEYCODE_A" 
30 -> "KEYCODE_B" 
31 -> "KEYCODE_C" 
32 -> "KEYCODE_D" 
33 -> "KEYCODE_E" 
34 -> "KEYCODE_F" 
35 -> "KEYCODE_G" 
36 -> "KEYCODE_H" 
37 -> "KEYCODE_I" 
38 -> "KEYCODE_J"
39 -> "KEYCODE_K" 
40 -> "KEYCODE_L" 
41 -> "KEYCODE_M" 
42 -> "KEYCODE_N" 
43 -> "KEYCODE_O" 
44 -> "KEYCODE_P" 
45 -> "KEYCODE_Q" 
46 -> "KEYCODE_R" 
47 -> "KEYCODE_S" 
48 -> "KEYCODE_T" 
49 -> "KEYCODE_U" 
50 -> "KEYCODE_V" 
51 -> "KEYCODE_W" 
52 -> "KEYCODE_X" 
53 -> "KEYCODE_Y" 
54 -> "KEYCODE_Z" 
55 -> "KEYCODE_COMMA" 
56 -> "KEYCODE_PERIOD" 
57 -> "KEYCODE_ALT_LEFT" 
58 -> "KEYCODE_ALT_RIGHT" 
59 -> "KEYCODE_SHIFT_LEFT" 
60 -> "KEYCODE_SHIFT_RIGHT" 
61 -> "KEYCODE_TAB" 
62 -> "KEYCODE_SPACE" 
63 -> "KEYCODE_SYM" 
64 -> "KEYCODE_EXPLORER" 
65 -> "KEYCODE_ENVELOPE" 
66 -> "KEYCODE_ENTER" 
67 -> "KEYCODE_DEL" 
68 -> "KEYCODE_GRAVE" 
69 -> "KEYCODE_MINUS" 
70 -> "KEYCODE_EQUALS" 
71 -> "KEYCODE_LEFT_BRACKET" 
72 -> "KEYCODE_RIGHT_BRACKET" 
73 -> "KEYCODE_BACKSLASH" 
74 -> "KEYCODE_SEMICOLON" 
75 -> "KEYCODE_APOSTROPHE" 
76 -> "KEYCODE_SLASH" 
77 -> "KEYCODE_AT" 
78 -> "KEYCODE_NUM" 
79 -> "KEYCODE_HEADSETHOOK" 
80 -> "KEYCODE_FOCUS" 
81 -> "KEYCODE_PLUS" 
82 -> "KEYCODE_MENU" 
83 -> "KEYCODE_NOTIFICATION" 
84 -> "KEYCODE_SEARCH" 
85 -> "TAG_LAST_KEYCODE"

2014年11月19日 星期三

How to add drawable resource

1. 建立 res/drawable folder
2. File/New/Android XML File
3. Resource Type: Drawable
4. 輸入 File
5. 選擇 Root Element

How to add PreferenceActivity

1. 建立 res/xml folder
2. File/New/Android XML File
3. Resource Type: Preference
4. 輸入 File
5. 選擇 Root Element

2014年11月18日 星期二

Android Eclipse 換 icon

1. File/New/Other...
2. 選 Android/Android Icon Set 按 Next
3. 填寫 Icon Name 按 Next

2014年9月29日 星期一

Eclipse 搬家

因為 Omondo 之 EclipseUML 不能在 Eclipse 4.4 中執行
直接搬舊的版本到新電腦

1.按 Menu/Window/Preferences
2.選 Server/Runtime Environments
3.選擇 Apache Tomcat v6.0
4.按 Edit...
5.按 Browse...
6.重新選擇 Tomcat installation directory

1.按 Menu/Project/Properties
2.選 Java Build Path
3.選 Libraries 頁簽
4.移除 Apache Tomcat v6.0, 並重新安裝
5.移除 JRE System Library, 並重新安裝

執行時出現 "The archive: C:/Program Files/Apache Software Foundation/Tomcat 6.0/bin/bootstrap.jar..." 錯誤
1.按 Menu/Run/Run Configurations...
2.選 Apache Tomcat/Tomcat v6.0 Server at localhost
3.選 Classpath
4.刪除 User Entries 之錯誤的 bootstrap.jar

執行時出現 "Could not load the Tomcat server configuration..." 錯誤
按 Detail 顯示 "resource is out of sync with the filesystem"
1.按 Menu/Window/Preferences
2.選 General/Workspace
3.勾選 Refresh automatically
4.按 OK
5.重新取消勾選 Refresh automatically

網址:
http://localhost:8080/DigiChance/LightLog/index.html
http://localhost:8080/Kennel/ym/util/Program.xml

因為要與 64bits Java 共存
新增 exlipse.bat, 指定 32bits Java 所在
PATH=C:\Program Files (x86)\Java\jre7\bin;%PATH%
start c:\eclipse3_32\eclipse.exe


2014年9月24日 星期三

Export apk from Eclipse

1.在專案上按右鍵 > Android Tools > Export Signed Application Package...
2.預設專案名稱,不要動
3.選擇 Create new keystore(因為之前尚未建立)
4.記住 password,等一下要用
5.輸入 Alias, Password, Validity(使用年限), First and Last Name 等
6.選擇apk的位置

JSP in Eclipse

1.進 Eclipse
2.選擇 Help/Install New Software
3.選擇Indigo - http://download.eclipse.org/release/indigo
4.勾選 Pending...
5.勾選 Web, XML, Java EE and OSGi Enterprise Develepment
6.安裝 Tomcat
7.再進Eclipse
8.選擇 Windows/Preference
9.選擇 Server/Runtime Environments
10.選擇 Add...
11.選擇 Tomcat 版本
12.填入 Tomcat 安裝路徑
13.按 Finish


2014年9月23日 星期二

Android in Eclipse

1.下載並安裝 Java SE 7
2.至 http://developer.android.com/sdk 下載 SDK Tools Only 並解壓縮
3.下載並安裝 Eclipse Standard 4.4, 使用 zip
4.執行 eclipse
5.按功能表 Help/Install New Software
6.按 Add, Name 輸入 ADT Plugin, Location 輸入 http://dl-ssl.google.com/android/eclipse
7.勾選 Developer Tools, 按 Next
8.選擇 I accept the terms of the license agreements, 按 Finish
9.按 OK, 再按 Yes, 重新啟動 Eclipse
10.重新啟動 Eclipse 後按 Open Preferences, 再按 Proceed
11.按 Browse 選擇步驟2的解壓縮目錄
12.按OK, 按Close, 按Close
13.按Cancel
14.按功能表 Window/Android SDK Manager
15.安裝所需的 Packages
16.按功能表 Window/Android Virtual Device Manager
17.按 New 建立 Android 模擬裝置

以上參考 準備 Android 開發環境

設定環境變數 ANDROID_SDK_HOME=D:\Users\mark
改變 Android Virtual Device Manager 位置