Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read text file in Javascript Rhino

I am writing a code to read a local text file into my No Magic Cameo Systems Modeler. I am using Javascript Rhino for the same. But not getting any viable solution to read the text file.

enter image description here

I used Java's bufferedReader class but then I am getting the following error :

"org.mozilla.javascript.EvaluatorException: missing ; before statement (#25)"

Can anyone assist me in what I am doing wrong. I am fairly new to javascript .

like image 963
shikha Avatar asked Jun 28 '26 02:06

shikha


1 Answers

You're trying to execute Java code, not JavaScript code, so Rhino throws an error because you're not providing it valid JavaScript code

For example File fileR = ...: this is Java code. The JavaScript equivalent is: var fileR = ....

like image 84
Paul Avatar answered Jun 29 '26 15:06

Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!