我们已经使用jpackage打包了我们的应用程序,并且效果很好。
以某种方式无意中从安装目录中删除了主jar。从那时起,“。exe”无法启动(很明显)。问题是它没有显示任何类型的错误消息,因此我们花了一段时间才意识到出了什么问题。
是否可以通过某种方式让exe至少显示一些有用的错误消息?
答案 0 :(得分:2)
如果使用void prepareObject(const matlab::data::Array& corners, const matlab::data::Array& facets)
{
size_t N_facet_rows = facets.getDimensions()[0];
size_t N_facet_columns = facets.getDimensions()[1];
matlab::data::TypedArray<std::complex<double>> complex_facets = arrayFactory.createArray<std::complex<double>>(facets.getDimensions());
// Convert the facets to a complex-valued array.
if (facets.getType() == ArrayType::DOUBLE) {
std::complex<double> v;
// Input is DOUBLE, so for each value init a complex<double> and store that in the complex array.
v.imag(0);
for (int i_r = 0; i_r < N_facet_rows; i_r++) {
for (int i_c = 0; i_c < N_facet_columns; i_c++) {
v.real(facets[i_r][i_c]);
complex_facets[i_r][i_c] = v;
}
}
}
else {
// Input is COMPLEX_DOUBLE, so simply copy all values.
for (int i_r = 0; i_r < N_facet_rows; i_r++) {
for (int i_c = 0; i_c < N_facet_columns; i_c++) {
complex_facets[i_r][i_c] = (std::complex<double>) facets[i_r][i_c];
}
}
}
参数激活控制台,则可以更容易地诊断jpackage生成的EXE问题。
您可能不想对主应用程序EXE执行此操作,因此可以使用第二个启动器来分发您的应用程序,该启动器启用了控制台并且具有相同的主类。只需创建一个新文件jpackage --win-console
并使用:
appwithconsole.properties
appwithconsole.properties
jpackage --add-launcher debugversion=appwithconsole.properties ... rest of command line.
然后在删除jar后尝试main-class=as.used.in.command.line
win-console=true
,它应该比没有控制台的EXE更清楚地报告错误:
debugversion.exe