Why the `java2` extension? We require a `.java` file, otherwise we can not run the file.
Also, make sure that both the `.java` and `.cookie` files are created before opening the `.cookie` file.
Finally, you may want to consider using `DataObject.find(cookieFile)` to get the open cookie instead.
I'm not sure if this last step is required though, so leave it out. 
But if you run into any problems you might want to try adding it.