streetlight
streetlight

Reputation: 5968

JSDoc without Java?

I'm trying to incorporate JSDoc into my Grunt deployment process. When I run it, I get the following error (expectedly):

>> JAVA_HOME is not set. Jsdoc requires Java to run.
Fatal error: Bad argument

I know that JSDoc is java-based, but I'm hoping to remove Java from the equation wholly. Is there a way to do this with the existing grunt plugin, or another that runs the process in Node only?

I don't want to add Java just for one task. Is this a fool's errand?

Upvotes: 5

Views: 1550

Answers (3)

Pier
Pier

Reputation: 1

I came across the same problem, and built a little Grunt plugin wrapping JSDoc 3.3 (no need for Java, all running in Node):

https://github.com/usrz/javascript-grunt-jsdoc-ng

Upvotes: 0

Matthew Rankin
Matthew Rankin

Reputation: 461217

The JSDoc dependency on Java, required by Mozilla Rhino, has been removed in JSDoc 3.3.0. The JSDoc GitHub page states:

Native support for Node.js is available in JSDoc 3.3.0 and later. JSDoc supports Node.js 0.10 and later.

JSDoc v3.3.0 is still in alpha release status (3.3.0-alpha4 was released on Jan 26, 2014), so to install the latest alpha version use:

npm install jsdoc@"<=3.3.0"

Upvotes: 4

Steve P
Steve P

Reputation: 19397

There's no way to do this from the current grunt jsdoc plugin. The issue is with the underlying jsdoc utility of course. You can track their progress toward supporting node.js instead of Rhino here:

https://github.com/jsdoc3/jsdoc/issues/93

However, a couple notes about that error you're seeing.

  • At least on Linux, as long as java is in the path, you can safely ignore that error and it will still generate.
  • see this question for some other discussion about JAVA_HOME and grunt-jsdoc-plugin

Upvotes: 5

Related Questions