Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Error running java class. - Detail: Security preference 'File system access' does not allow 'read' access to "file.stp"

Please login with a confirmed email address before reporting spam

Hello.

I'm writing a COMSOL model file using the Java COMSOL API, and I'm encountering a problem with running the files in batch mode. In particular, when I put in the code to import a CAD stp file: model.geom("geom1").feature().clear();

model.modelPath("D:\ION\NEW_DATA");

model.component("comp1").geom("geom1").create("imp"+i, "Import"); model.component("comp1").geom("geom1").feature("imp"+i).set("type", "cad"); model.component("comp1").geom("geom1").feature("imp"+i) .set("filename", "D:\NEW_DATA\DrystoreLayer_"+i+".stp"); model.component("comp1").geom("geom1").feature("imp"+i).label("DrystoreLayer_"+i); model.component("comp1").geom("geom1").feature("imp"+i).importData(); model.geom("geom1").run("fin"); When I try to run the model in batch mode using When I try to run the model in batch mode using

comsolbatch -inputfile <file.class> -outputfile <output.mph> -batchlog <log.txt>

it doesn't run successfully. Also using the builder or importing the.class file I got this error Error running java class. - Detail: Security preference 'File system access' does not allow 'read' access to 'D:\NEW_DATA\DrystoreLayer_1.stp'.

It is something related to the Java Security Management! Do you have any idea how to solve that ? I tried with java.policy but it still not worked. My JDK and JRE are 32 bits! Can that be the problem ?

Best Regards,

Ion


2 Replies Last Post 2018年1月27日 GMT-5 15:43

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年11月27日 GMT-5 05:24

It is solved now! Select File->Preferences->Security, then in "Java and Java Libraries" set option "File system access:" to "All Files". It should work now!

Ion

It is solved now! Select File->Preferences->Security, then in "Java and Java Libraries" set option "File system access:" to "All Files". It should work now! Ion

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年1月27日 GMT-5 15:43
Updated: 6 years ago 2018年1月27日 GMT-5 16:12

Update. In Comsol 5.3a, you need to follow:

Comsol>File>Preferences>Security>Methods and Java Libraries>File system access>"All Files"

Update. In Comsol 5.3a, you need to follow: Comsol>File>Preferences>Security>Methods and Java Libraries>File system access>"All Files"

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.