0

谢谢,在我的项目出现问题之前,我的项目是在 android 中制作应用程序,然后应用程序可以连接到我公司的数据库,但这不是连接

这是我的脚本

 package mas.ganteng;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Mas Ganteng Indonesia
 */
     public class ConnectedAccessActivity {
 Connection conn;
 String url="jdbc:odbc:JavaMsAccess";
 String user="";
 String pass="";
 public Connection getConnection(){
 try {
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 conn=DriverManager.getConnection(url,user,pass);
 System.out.println("Connected!!!");
 } catch (SQLException ex) {
 Logger.getLogger(ConnectedAccessActivity.class.getName()).log(Level.SEVERE, null, ex);
 } catch (ClassNotFoundException ex) {
 Logger.getLogger(ConnectedAccessActivity.class.getName()).log(Level.SEVERE, null, ex);
 }
 return conn;
 }
 public static void main(String [] args){
 ConnectedAccessActivity acc=new ConnectedAccessActivity();
 acc.getConnection();
 }

}

它是eclipse中的控制台

    Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (javaClasses.cpp:124), pid=3848, tid=3876
#  fatal error: Invalid layout of preloaded class
#
# JRE version:  (8.0-b104) (build )
# Java VM: Java HotSpot(TM) Client VM (25.0-b46 mixed mode windows-x86 )
# 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:
# D:\My Android\ConnectedAccess\hs_err_pid3848.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

你能帮我解决这个错误吗??????

4

1 回答 1

0

java.lang.String 在值的布局无效

您正在尝试将 Android 应用程序作为常规 Java 程序运行。在 Android 模拟器或实际设备上运行 Android 应用程序。

代码看起来只是一个普通的 Java 程序。您应该从中删除 Android 库,以便能够将其作为 Java 运行。

于 2014-05-13T07:24:13.063 回答