How To Run The PhantomJS Script From Java-EE Application Without Specification Of Script Full Path?

I need to convert some HTML content to PDF or image in my server side app Java EE. For this, I am using the PhantomJS and script "resterize.js".

Problem is, that I need to specify the path of the rasterize.js script. I would like to use only command like this:

phantomjs rasterize.js "" test.pdf [my another arguments]

I found it is possible to use GhostDriver and include it into the Java app, but then I dont know, if it is possible to run same rasterize.js script.

Thanks for any answer.



If you don't want to specify the full path in your app, you can define it into an environment variable and then read it like this:

String base_path = System.getenv("script_base_path");

Does it help you ?