eclipsenullpointerexceptionphantomjsnodeclipse

PhantomJS Project in Eclipse (with Nodeclipse): NullPointerException when trying to run js file that is present in a folder


I wish to create a PhantomJS Project in Eclipse for which I have installed the Nodeclipse PhantomJS 0.12+ plugin. I am selecting the below project type:

enter image description here

The script runs fine when I arrange the project in the following way (without any folders).

enter image description here

But, when I place the same .js file in a folder and try to run it, I end up getting a NullPointerException (see screenshot below).

enter image description here

The error that I'm getting is below:

An internal error occurred during: "Launching PhantomJSTest-Test1.js".
java.lang.NullPointerException

Screenshot:

enter image description here

What I have tried: I found a similar question on Stackoverflow with the same error but for Android. I have tried cleaning, building the project. But, the error occurs only when I create a folder structure in my project. If I don't, then the script runs fine. In short, I am not able to organize the project.

Questions:

  1. I'd like to know what type of folder structure is valid / will work for a PhantomJS project?
  2. Why is the NullPointerException occuring?
  3. Are there any other easy alternatives to setting up a PhantomJS project?

Any help / guidance regarding the folder structure is highly appreciated.


Solution

  • I switched to using Enide Studio and that solved the folder structure issue for me.

    Here's what is needed to setup PhantomJS Project:

    1. PhantomJS
    2. Enide Studio

    Steps:

    1. Download PhantomJS
    2. Download and launch Enide Studio
    3. Goto Window->Preferences->Nodeclipse->PhantomJS and set PhantomJS Path to 'phantomjs.exe' file path

    enter image description here

    1. Create a PhantomJS Project (like any normal project)