首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在COMSOL中导入java.security.AccessController?

如何在COMSOL中导入java.security.AccessController?
EN

Stack Overflow用户
提问于 2019-08-14 04:03:16
回答 1查看 273关注 0票数 2

当我试图从我的App GUI运行我的COMSOL脚本时,当我试图从我的本地硬盘驱动器加载.STL文件时,我收到一个'AccessControlException‘。

代码语言:javascript
复制
AccessControlException: Security preference 'File system access' does not allow 'read' access to 'C:\Users\peter\STL_Examples\beam_0.STL'.

错误由以下代码中的最后一行代码触发: model.mesh("mpart1").run();

this post中,我了解到我也许可以通过使用AccessController.doPriviledged(...)来解决这个问题。但是,当我尝试在COMSOL中导入AccessController时,我得到一条错误消息,指出无法将java.security.AccessController解析为变量。

代码语言:javascript
复制
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问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-14 05:28:53

我在COMSOL应用程序设置中找到了这个问题的解决方案。在“文件”菜单中,单击“首选项”,然后选择“安全”部分。然后将“文件系统访问:”更改为“所有文件”。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57484606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档