简体   繁体   English

Netbeans在调试器中没有拾取Java类

[英]Netbeans doesnt pick up Java classes in debugger

This is doing my head right in! 这就是我的想法!

I am messing about with JRuby trying to make some Java calls. 我在用JRuby尝试进行一些Java调用而感到困惑。 Here is the source Im messing with. 这是我搞砸的来源。

require 'java'

module JavaLang
  include_package "java.lang"
end

module JavaSql
  include_package 'java.sql'
end

begin
    JavaLang::Class.forName("com.mysql.jdbc.Driver").newInstance
    jdbcconnection = JavaSql::DriverManager.getConnection("jdbc:mysql://localhost:3306/accounts", 'root', '');

    puts 'Werked'
rescue Exception => ex
    connectmsg = "Could not connect to the database: " + ex.message;
    puts connectmsg
end

I am using Netbeans 6.8 as the IDE. 我正在使用Netbeans 6.8作为IDE。

When I run the script it all works fine and I get Werked printing out in the output. 当我运行脚本时,一切正常,我在输出中得到了Werked打印。

When I try to run this through on the debugger I get 当我尝试在调试器上运行此程序时,我得到了

Could not connect to the database: java.lang.ClassNotFoundException: com/mysql/jdbc/Driver 无法连接到数据库:java.lang.ClassNotFoundException:com / mysql / jdbc / Driver

Im sure its just something basic to do with setting a debugger configuration, but I can't find anything anywhere to give me a clue. 我肯定这只是设置调试器配置的基本步骤,但是我找不到任何可以提供线索的地方。

Why would the debugger not pick up these java classes? 调试器为什么不选择这些Java类?

Edit 编辑

Just to follow up, this is a bug in Netbeans 6.8. 只是为了跟进,这是Netbeans 6.8中的一个错误。 Here is the bug report . 这是错误报告

Relieved that Im not going mad! 解除我不生气!

This seems like a general classpath issue. 这似乎是一般的类路径问题。 The fact that the reflection fails, supports this. 反射失败的事实支持了这一点。 Are you sure that your classpath is the same / similar to your runtime classpath? 您确定您的类路径与运行时类路径相同/相似吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM