[英]running 32 bit jvm alongside 64 bit jvm in eclipse
I am trying to create a connection to a 32 bit Microsoft access 2010 database using Java and 64 bit eclipse eclipse in windows 7. 我试图在Windows 7中使用Java和64位eclipse eclipse创建与32位Microsoft Access 2010数据库的连接。
I created a 32 bit system dns by reading this link . 我通过阅读此链接创建了32位系统dns。 The program to create the 32 bit dns is located at: 创建32位dns的程序位于:
c:\windows\sysWOW64\odbcad32.exe
In an attempt to configure eclipse to run the java class as 32-bit, I selected Run as... Run Configurations --> (Arguments tab) and entered -d32 in the VM Arguments box, then clicked run. 在尝试配置eclipse以将java类作为32位运行时,我选择Run as ... Run Configurations - >(Arguments选项卡)并在VM Arguments框中输入-d32,然后单击run。 However, trying to run the program resulted in a dialog box saying: 但是,尝试运行该程序会导致出现一个对话框:
"Could not create the java virtual machine"
Here is the code for the class I am using to test a connection to the system dns: 这是我用来测试与系统dns的连接的类的代码:
public class SoftwareDeveloper {
public static void main(String[] args){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:MYDSNCONNECTION");
Statement st = conn.createStatement();
ResultSet rest = st.executeQuery("SELECT * FROM myTable");
while(rest.next()){
System.out.println(rest.getString(1));
System.out.println(rest.getString(2));
}
}
catch (ClassNotFoundException cnfe){cnfe.printStackTrace();}
catch (SQLException e) {e.printStackTrace();}
}
}
I am guessing this means I created a 32 bit system dns successfully, but that eclipse is not able to find a 32 bit jdk. 我猜这意味着我成功创建了32位系统dns,但是eclipse无法找到32位jdk。 I want to keep using 64 bit jdk with eclipse, but is there some way to configure eclipse so that it can switch from a default 64 bit jdk to a 32 bit jdk when -d32 is given in the run configurations? 我想继续使用64位jdk和eclipse,但有没有办法配置eclipse,以便在运行配置中给出-d32时它可以从默认的64位jdk切换到32位jdk? Or is there another solution? 还是有其他解决方案吗?
NOTE: Installing 64 bit version of MS Access or deleting Access and downloading an Access database engine from Microsoft are not options for unrelated reasons. 注意:安装64位版本的MS Access或删除Access并从Microsoft下载Access数据库引擎不是出于无关原因的选项。
Download and install a 32-bit JRE (or JDK) on your system. 在系统上下载并安装32位JRE(或JDK)。
Find your Launch Configuration (Run As-> Run Configurations...) under Java Application branch. 在Java Application分支下找到启动配置(Run As-> Run Configurations ...)。
Go to the JRE tab and select Alternate JRE. 转到JRE选项卡并选择Alternate JRE。 Click on Installed JREs... button, add your 32-bit JRE and select it. 单击Installed JREs ...按钮,添加32位JRE并选择它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.