未定义的变量“调制解调器”或类“modem.pskmod”从Java调用时
-
21-09-2019 - |
题
我已经写在MATLAB其中调制和解调的一些信号的码。我用deploytool
部署它们和.jar
在一个应用程序的工作原理没有GUI,但给我的Undefined variable "modem" or class "modem.pskmod".
与GUI应用程序。
基本上,我想知道是什么会导致此错误发生,因为我有环顾四周,我没有对这个错误发现很多文档。什么
由于我不明白为什么它在一个应用程序中工作,但无法在其他时候我的代码使用调用方法时几乎是相似的。
解决方案
确定,经过多次试验和比较的应用程序之间的差异没有GUI和与GUI的应用程序。我发现了一个解决我的问题。
作为没有GUI运行的应用程序从应用程序的启动初始化方法(只有一个线程),点击
import matlabFunction.*;
public static void main(String[] args) {
matlabFunction test = new matlabFunction();
test.runFunction(1, lstABC.toArray());
}
但是,在我与GUI我代码从JFrame中内运行init方法(main()中包含我的初始化代码),它是里面EDT
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
new main();
} catch (Exception p) {
}
}
});
}
与上述方式给init MATLAB方法发生错误。但是,如果调用init方法如下面的我变化方式,该错误是解决。
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
matlabFunction test = new matlabFunction();
new main(test);
} catch (Exception p) {
}
}
});
}
所以,我相信我的问题的原因是没有要求从启动应用程序的“第一”线程init方法。