|
[Sponsors] |
December 1, 2016, 09:28 |
Reading data from textfile into macro
|
#1 |
Member
Join Date: Aug 2014
Location: Germany
Posts: 77
Rep Power: 11 |
Hi,
I wish to read some parameters from a text file and use it to assign values in a starccm macro. The code looks something like this: java.io.FileReader freader = new java.io.FileReader("pathToFile"); java.io.BufferedReader inputFile=new java.io.BufferedReader(freader); //courseName=inputFile.readLine(); while ((line=inputFile.readLine())!= null) { String[] arrayline = line.split("\\s+"); data[i] = Double.parseDouble(arrayline[1]); } inputFile.close(); R = data[0]; L = data[1]; r = data[2]; l = data[3]; angle = data[4]; I'm getting a error:unreported exception, java.io.FileNotFoundException; must be caught or declared to be thrown. I'm not too familiar with java, but still have tried all possible suggestions given in java forums. I'm not sure if the issue is related to how java scripts work in StarCCM. It would be great help if someone can help me out ! |
|
December 1, 2016, 14:45 |
|
#2 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24 |
You are not telling Java what to do in case the file you specify doesn't exist.
https://examples.javacodegeeks.com/j...und-exception/ |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFD by anderson, chp 10.... supersonic flow over flat plate | varunjain89 | Main CFD Forum | 18 | May 11, 2018 07:31 |
Reading data from node file in UDF | avd28 | Fluent UDF and Scheme Programming | 2 | August 24, 2015 16:49 |
Parallel fluent and slow data reading on more than 24 cores | mahdi_izadi | FLUENT | 0 | February 10, 2015 08:39 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 09:28 |
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 12 | May 2, 2013 10:52 |