Nullpointer exception, even tho I can print data from the file!
Hai!
Heres my code:
Code:
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("py");
try{
FileReader file = new FileReader("C:\\Users\\Andreas\\Desktop\\t.py");
System.out.println(file);
engine.eval(file);
file.close();
} catch (Exception e){
e.printStackTrace();
}
Now I get nullpoint exception at the engine.eval part, Even tho I can print the file, assuring that it is NOT null!:eek:
I have no clue whats wrong, do you?