When I run the following script from command line,
Needs["JLink`"];
ConnectToFrontEnd[];
resultChart = UseFrontEnd[JuliaSetPlot[0.365 - 0.37 I]];
UseFrontEnd[Export["test.png", resultChart]];
CloseFrontEnd[];
the graphic file gets written out fine. In fact, the calls to ConnectToFrontEnd, UseFrontEnd, CloseFrontEnd are not even necessary.
However, if I call this script from Windows task scheduler, the function ConnectToFrontEnd returns True, but then an error is returned:
Rasterize::type : Notebook[ -- omitted --] cannot be rasterized.
I am aware of these two, similar questions, however I do not know what to do now here.
UsingFrontEnd, so you don't needUseFrontEndfrom J/Link. But neitherJuliaSetPlot, norExportneed it. (Exportshould make use of it internally). I don't know why it doesn't work for you, but what happens if you drop the unneeded parts? – Szabolcs Dec 08 '16 at 17:43Head@UsingFrontEnd[$FrontEnd] === FrontEndObject– Szabolcs Dec 08 '16 at 17:46Head@UsingFrontEnd[$FrontEnd]===FrontEndObjectreturns True. Switching toUsingFrontEnddid not help. Running the task with the option checked "only run if user is logged on" (which I interpret as making sure that there is access to a desktop session) does work! I am not an admin, so I am not sure if that is an option in the long run. – Karsten W. Dec 09 '16 at 10:25