【问题标题】:Import Issue Java TTest导入问题 Java 测试
【发布时间】:2023-03-09 03:10:02
【问题描述】:

我正在尝试在我的程序中运行 TTest,但导入导入它所需的类不起作用。

这是我听说这门课的地方 http://commons.apache.org/proper/commons-math/apidocs/index.html?org/apache/commons/math3/stat/inference/TTest.html

我试过了:

import java.lang.Object.org.apache.commons.math3.stat.inference.TTest;

和

import org.apache.commons.math3.stat.inference.TTest;

以及一些不起作用的组合。

如果你知道怎么做,请告诉我!

在里面我正在使用

TTest test = new TTest();  

所以如果这是错误,请告诉我!

【问题讨论】:

  • 你的类路径中有commons-math吗?您得到的具体错误是什么?
  • 我不知道将 commons-math 放在我的类路径中意味着什么。 :(
  • I getException in thread "main" java.lang.Error: Unresolved compiler questions: TTest cannot be resolve to a type TTest cannot be resolve to a type at MatchTx.weightPathways(MatchTx.java:287)在 MatchTx.main(MatchTx.java:37)

标签: java import apache-commons


【解决方案1】:

import org.apache.commons.math3.stat.inference.TTest; 是从commons-math 导入TTest 类的正确方法。

由于TTest 属于一个外部库(commons-math),你必须下载它并告诉 Java 在哪里可以找到它来构建和运行你的程序,这是类路径,如果你正在使用它应该定义一个不属于默认标准 Java 类的类。如果你不知道 Java 中的类路径和外部库,你应该明确地read and google about the subject。

【讨论】:

  • 如果它回答了您的问题,您可以接受答案。你(和我)将获得声望点数。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多