2014年9月26日

開發GAE(Google App Engine)專安在Netbeans上

1.下載Google App Engine SDK

https://cloud.google.com/appengine/downloads?hl=zh-Tw

2.參考Google App Engine on Netbeans 8這篇文章
  1. Download the zipped file for Netbeans 7.4 from the Gaelyk download page.
  2. Extract the zip file into some directory.
  3. In Netbeans 8.0, follow to menu “Tools”, “Plugins”. And within the dialog, to “Downloaded” tab. Click “Add Plugin” and browse to the folder.
  4. Select all .nbm files and confirm.
  5. Watch out, don’t close the dialog! Instead, click on the small “Install” button at the left bottom corner.
  6. Go through the Wizard, confirm license, confirm “plugins not signed” warning and go on.
  7. Now you may close the dialog.
  8. Restart Netbeans.
Now, its time to configure the Google App Engine server.

  1. Open the “Services” window.
  2. Right click the “Servers” entry, select “Add server”.
  3. Go through the Wizard, select “Google App Engine”, browser to the directory where you previously unzipped it,  confirm ports and DataNucleus.


DONE!


可能遇到的問題:
1.找不到javac.exe,無法run 本機Google App Engine伺服器
2.找不到class
3.無法上傳到Google App Engine
4.email密碼驗證不過

1, 2. 的解決方式,是將環境變數中的PATH與CLASSPATH明確指定到jdk的 bin與lib下

3.的原因有幾種,若是path的問題可用上面的方式解決,但另外可能是JRE的衝突(  JRE會鎖定JAVA_HOME的路徑,導致專案無法編譯上傳,所以若設定Path後仍無法解決, 可以採取移除JRE的方式就可以解決)
若不想移除JRE,是打開Google App Engine Jave SDK套件裡的appcfg.cmd檔 (位在 appengine-java-sdk-1.3.0\bin )
原始appcfg.cmd開頭內容為
@java -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*

請修改為直接指定你的java.exe檔,若安裝位址在C:\Program Files\Java\jdk1.6.0_12\bin,
則可改寫如下:
@"C:\Program Files\Java\jdk1.6.0_12\bin\java" -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*

4.啟用安全性較低的應用程式存取權限 https://www.google.com/settings/security/lesssecureapps

沒有留言:

張貼留言