0
我在嘗試從資產文件夾複製數據庫時出現以下錯誤。代碼將android項目的資產文件夾中的sqlite數據庫複製到首選位置時出錯
Error: A fatal error has been detected by the Java Runtime Environment:
# Internal Error (classFileParser.cpp:3470), pid=6696, tid=4792
# Error: ShouldNotReachHere()
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0-b17 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# hs_err_pid6696.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
鏈接: Sqlite database not copied from asset folder Android
編輯:
AssetManager am = getApplicationContext().getAssets();
OutputStream os = new FileOutputStream("/data/data/"+getPackageName+"/databases/dbname.sqlite");
byte[] b = new byte[100];
int r;
InputStream is = am.open("dbname.sqlite");
while ((r = is.read(b)) != -1) {
os.write(b, 0, r);
}
is.close();
os.close();
}
我試圖運行此代碼.. 此代碼拷貝android系統中的來自資產文件夾數據庫。當我運行此code..it 示出上述誤差
此錯誤來自Sun JVM,而不是Android。你可能希望編輯你的問題來解釋,*正是*,你在哪裏得到這個錯誤以及你在做什麼來引起錯誤。 – CommonsWare 2013-03-18 11:46:02
我已經解決了這個問題.. 問題是我運行Android應用程序作爲Java應用程序,而不是作爲Android應用程序,所以它導致了這個JVM問題.. 我已經相應地設置了在Eclipse中的運行配置.. – 2013-03-19 05:49:36
添加回答描述您的解決方案/原因並將其標記爲正確的答案,請@Prannoy – kdehairy 2013-03-20 12:01:02