如何在 COMSOL 中导入 java.security.AccessController?
How to import java.security.AccessController in COMSOL?
当我尝试从我的应用程序 GUI 运行 我的 COMSOL 脚本时,我在尝试从我的本地硬盘驱动器加载 .STL 文件时收到 'AccessControlException'。
AccessControlException: Security preference 'File system access' does not allow 'read' access to 'C:\Users\peter\STL_Examples\beam_0.STL'.
错误由下面发布的代码中的最后一行代码触发:model.mesh("mpart1").运行();
从 this post,我了解到我可以使用 AccessController.doPriviledged(...) 来解决该问题。但是,当我尝试在 COMSOL 中导入 AccessController 时,我收到一条错误消息,指出 java.security.AccessController 无法解析为变量。
import java.security.AccessController;
clearModel(model);
model.component().create("comp1", true);
model.component("comp1").geom().create("geom1", 3);
model.component("comp1").mesh().create("mesh1");
model.component("comp1").geom("geom1").create("imp1", "Import");
AccessController.doPriviledged(
model.component("comp1").geom("geom1").feature("imp1").set("filename", "C:\Users\peter\STL_Examples\beam_0.STL")
);
model.component().create("mcomp1", "MeshComponent");
model.geom().create("mgeom1", 3);
model.mesh().create("mpart1", "mgeom1");
with(model.component("comp1").geom("geom1").feature("imp1"));
set("mesh", "mpart1");
endwith();
model.mesh("mpart1").create("imp1", "Import");
with(model.mesh("mpart1").feature("imp1"));
set("filename", "C:\Users\peter\STL_Examples\beam_0.STL");
endwith();
with(model.component("comp1").geom("geom1").feature("imp1"));
set("meshfilename", "");
endwith();
model.mesh("mpart1").run();
如何在 COMSOL 中导入标准 java 库?或者,我该如何解决 AccessControl 问题?
我在 COMSOL 应用程序设置中找到了这个问题的解决方案。
在 "File" 菜单中单击 "Preferences" 和 select "Security" 部分。
然后把"File system access:"改成'All files'.
当我尝试从我的应用程序 GUI 运行 我的 COMSOL 脚本时,我在尝试从我的本地硬盘驱动器加载 .STL 文件时收到 'AccessControlException'。
AccessControlException: Security preference 'File system access' does not allow 'read' access to 'C:\Users\peter\STL_Examples\beam_0.STL'.
错误由下面发布的代码中的最后一行代码触发:model.mesh("mpart1").运行();
从 this post,我了解到我可以使用 AccessController.doPriviledged(...) 来解决该问题。但是,当我尝试在 COMSOL 中导入 AccessController 时,我收到一条错误消息,指出 java.security.AccessController 无法解析为变量。
import java.security.AccessController;
clearModel(model);
model.component().create("comp1", true);
model.component("comp1").geom().create("geom1", 3);
model.component("comp1").mesh().create("mesh1");
model.component("comp1").geom("geom1").create("imp1", "Import");
AccessController.doPriviledged(
model.component("comp1").geom("geom1").feature("imp1").set("filename", "C:\Users\peter\STL_Examples\beam_0.STL")
);
model.component().create("mcomp1", "MeshComponent");
model.geom().create("mgeom1", 3);
model.mesh().create("mpart1", "mgeom1");
with(model.component("comp1").geom("geom1").feature("imp1"));
set("mesh", "mpart1");
endwith();
model.mesh("mpart1").create("imp1", "Import");
with(model.mesh("mpart1").feature("imp1"));
set("filename", "C:\Users\peter\STL_Examples\beam_0.STL");
endwith();
with(model.component("comp1").geom("geom1").feature("imp1"));
set("meshfilename", "");
endwith();
model.mesh("mpart1").run();
如何在 COMSOL 中导入标准 java 库?或者,我该如何解决 AccessControl 问题?
我在 COMSOL 应用程序设置中找到了这个问题的解决方案。
在 "File" 菜单中单击 "Preferences" 和 select "Security" 部分。
然后把"File system access:"改成'All files'.