Repository navigation
Can't run jsdoc on the included rhino bundle from Windows command line #533
Description
Activity
I can't reproduce this issue on Windows 7.
Do you have another version of Rhino in your CLASSPATH? Also, which version of Java are you using?
C:\Users\jason\Desktop\jsdoc-master>echo %CLASSPATH%
%CLASSPATH%C:\Users\jason\Desktop\jsdoc-master>java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)Try running
set CLASSPATHto get your actual classpath.Also, try running the command
java org.mozilla.javascript.tools.shell.Main. You should get the messageError: Could not find or load main class org.mozilla.javascript.tools.shell.Main. If not, you have Rhino on your classpath somewhere.C:\Users\jason\Desktop\jsdoc-master>set CLASSPATH
Environment variable CLASSPATH not definedC:\Users\jason\Desktop\jsdoc-master>java org.mozilla.javascript.tools.shell.Main
Error: Could not find or load main class org.mozilla.javascript.tools.shell.Main
Okay, three more things to try.
First, add the following code at line 8 of jsdoc.js:
java.lang.ClassLoader.getSystemClassLoader().getURLs().forEach(function(url) { print(url.toString()); });
That code will print the classpath that JSDoc is using at runtime. You should see a reference to
js.jarwithin JSDoc's package, and nothing else.If the classpath looks okay, try running
cmdas an administrator, then running JSDoc, and see if that makes a difference.And if that doesn't work, you could try upgrading to JDK 1.7.0_45, which is what I'm testing with right now. It shouldn't make a difference, but you never know.
If none of that stuff helps, I'm at a loss. I suggest emailing jsdoc-users to see if anyone else has encountered this issue. You could also run JSDoc with Node.js instead (but first, be sure to remove the
java.lang.ClassLoaderstuff I told you to add!):node jsdoc.jsClosing due to lack of information.
I have the same problems too.
Windows 8 64BitThe language is german but it mean the same as the messages above
C:\xyz\jsdoc3>echo %CLASSPATH% %CLASSPATH% C:\xyz\jsdoc3>java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing) C:\xyz\jsdoc3>set CLASSPATH Die Umgebungsvariable "CLASSPATH" ist nicht definiert. C:\xyz\jsdoc3>java org.mozilla.javascript.tools.shell.Main Fehler: Hauptklasse org.mozilla.javascript.tools.shell.Main konnte nicht gefunden oder geladen werdenRun cmd as administrator didn't work.
Source is the latest commit.
The function for line 8 shows the correct absolute-path to js.jarI didn't try it with "node"
@Soldier-Boy: Can you also try adding the extra code to jsdoc.js, as I suggested above? Please let me know what it prints to the console.Sorry, I didn't notice that you had already tried this. I'll reopen the issue and see if I can think of another idea.
Thank you.
Should CLASSPATH be empty?PS: renamed Soldier-Boy -> ximex
Edit:
I tried it with version 3.2.2 and it works.
Edit2:
The last commit that works is: a8c9100
If i take the js.jar from this commit into the newest commit this error message removes.
This new errors appears:C:\Users\thomas\git\jsdoc>jsdoc.cmd -T Exception in thread "main" java.lang.IllegalArgumentException: URI scheme is not "file" at java.io.File.<init>(Unknown Source) at org.jsdoc.JsDocModuleProvider.loadFromUri(JsDocModuleProvider.java:36 ) at org.mozilla.javascript.commonjs.module.provider.UrlModuleSourceProvid er.loadFromPathList(UrlModuleSourceProvider.java:108) at org.mozilla.javascript.commonjs.module.provider.UrlModuleSourceProvid er.loadFromPrivilegedLocations(UrlModuleSourceProvider.java:89) at org.mozilla.javascript.commonjs.module.provider.ModuleSourceProviderB ase.loadSource(ModuleSourceProviderBase.java:37) at org.mozilla.javascript.commonjs.module.provider.CachingModuleScriptPr oviderBase.getModuleScript(CachingModuleScriptProviderBase.java:65) at org.mozilla.javascript.commonjs.module.provider.SoftCachingModuleScri ptProvider.getModuleScript(SoftCachingModuleScriptProvider.java:63) at org.mozilla.javascript.commonjs.module.Require.getModule(Require.java :359) at org.mozilla.javascript.commonjs.module.Require.getExportedModuleInter face(Require.java:260) at org.mozilla.javascript.commonjs.module.Require.call(Require.java:214) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:170 1) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.j ava:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:4 26) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:317 8) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.j ava:175) at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:654) at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:5 52) at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:507) at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:499) at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:215) at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:134) at org.mozilla.javascript.Context.call(Context.java:521) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:535) at org.mozilla.javascript.tools.shell.Main.exec(Main.java:198) at org.mozilla.javascript.tools.shell.Main.main(Main.java:174)@ximex: Are you saying that commit a8c9100 works fine, and commit 6651a85 fails? That would be surprising, but it's not impossible.
If commit 6651a85 also works for you, it would be extremely helpful if you could use
git bisectto find the first commit that fails. If you're not familiar with this command, there's an excellent tutorial (auf Deutsch) that should help.It makes sense that
js.jarfrom a8c9100 no longer works on master. We now depend on a more recent version ofjs.jar.I have the same issue, with JSDoc 3.3 on Windows XP SP3
No issue with JSDoc 3.2 though.C:\abc\jsdoc\jsdoc.js is available in my directory.
C:\abc\jsdoc>jsdoc -T js: exception from uncaught JavaScript throw: Error: Module "C:\abc\jsdoc.js" not found C:\abc\jsdoc>echo %CLASSPATH% %CLASSPATH% C:\abc\jsdoc>set CLASSPATH Environment variable CLASSPATH not defined C:\abc\jsdoc>java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)6 remaining items
Hello there,
- I cloned the repo (HEAD) and copied it to a folder without permission issues (D drive in my case)
- Windows 7, English, 64Bit, SP1
- "version": "3.3.0-alpha4", "revision": "1390711878557"
- Commandline: jsdoc.cmd -c
$MY_PROJECT_DIR$ \jsdocconf.json
I followed more or less this tutorial:
http://www.speich.net/articles/2013/07/19/generate-javascript-documentation-with-jsdoc-3-and-phpstorm/I have the same problem -- here are the steps I took:
- Downloaded master.zip from https://github.com/jsdoc3/jsdoc/archive/master.zip
- Extracted to c:\jsdoc
- Ran jsdoc --help and received the following error: "js: exception from uncaught JavaScript throw: Error: Module "c:/jsdoc/jsdoc.js" not found."
Here's my Java version information:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)I'm trying this on Windows 8, 64-bit.
edit: like ximex, a8c9100 works however.
Thanks, everyone. I can reproduce this and am investigating.
I also encountered the same problem.
I have modified "jsdoc.cmd" as follows. Then, the problem was solved.
[before] SET _BASEPATH=%_BASEPATH:\=/% [after] rem SET _BASEPATH=%_BASEPATH:\=/%My environment is follows.
- OS
- Windows7 64bit SP1
- java
- 1.7.0_51
- package.json
- version : 3.3.0-alpha4
- revision : 1390711878557
- OS
- added a commit that references this issue
on Feb 15, 2014 @opengl-8080, that seems to have fixed the issue! Many thanks for figuring this out.
Everything should be working fine on master. If anyone continues to see this error after doing a pull, please reopen the issue.
@adufilie: I just cloned the repo from master, and I am not able to reproduce this issue. Please provide the following information so I can investigate further:
- How did you install JSDoc?
- In what directory did you install JSDoc?
- What command did you use to run JSDoc?
- What is the exact error message you are getting?
- Which version of Java are you using? (Run
java -versionto get this.) - What output do you get from the following commands?
set CLASSPATHset JAVA_HOMEjava org.mozilla.javascript.tools.shell.Main
(Updated)
Short answer: It works now that I switched to the Windows command prompt. It didn't work in cygwin. This may be due to them using different versions of Java.
Long answer:
- How did you install JSDoc?
$ git clone git@github.com:jsdoc3/jsdoc.git
- In what directory did you install JSDoc?
C:\jsdoc</code>
- What command did you use to run JSDoc?
$ jsdoc
- What is the exact error message you are getting?
js: exception from uncaught JavaScript throw: Error: Module "c:/jsdoc/jsdoc.js" not found.
- Which version of Java are you using? (Run java -version to get this.)
- What output do you get from the following commands?
set CLASSPATHset JAVA_HOMEjava org.mozilla.javascript.tools.shell.Main
In Cygwin Shell:
$ java -version java version "1.6.0_35" Java(TM) SE Runtime Environment (build 1.6.0_35-b10) Java HotSpot(TM) Client VM (build 20.10-b01, mixed mode, sharing) $ echo $CLASSPATH .;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip $ echo $JAVA_HOME C:\Program Files (x86)\Java\jdk1.6.0_18 $ jsdoc js: exception from uncaught JavaScript throw: Error: Module "c:/jsdoc/jsdoc.js" not found.
In Windows Command Prompt:
C:\jsdoc>java -version java version "1.6.0_27" Java(TM) SE Runtime Environment (build 1.6.0_27-b07) Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode) C:\jsdoc>set CLASSPATH CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip C:\jsdoc>set JAVA_HOME JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_18 C:\jsdoc>jsdoc (No error)
I switched to the Windows command prompt and the jsdoc error went away. However, I receive an error on the last command (in both command prompts):
C:\jsdoc>java org.mozilla.javascript.tools.shell.Main Exception in thread "main" java.lang.NoClassDefFoundError: org/mozilla/javascript/tools/shell/Main Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.tools.shell.Main at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: org.mozilla.javascript.tools.shell.Main. Program will exit.Question:
The error messageModule "c:/jsdoc/jsdoc.js" not found.does not make sense since the file exists. Any idea why it thinks that? Is there a way I could set a breakpoint or add print statements to debug it myself?- How did you install JSDoc?
@adufilie: Many thanks for following up so thoroughly! I'm glad you were able to resolve the issue.
The error from running
java org.mozilla.javascript.tools.shell.Mainis expected. If you already had Mozilla Rhino on your classpath (which can cause problems for JSDoc), that command would not have generated an error.The error message is generated by Java code in Rhino, so it's not so easy to trace at runtime.
Hi all, encountering this issue when attempting to run tests from Windows via
jsdoc -T:Edit: using 6b85173
Edit 2: If I change the classpath in the java command to
rhino/js.jarI get somethingC:\Users\djthomps\Desktop\closure\sample4\jsdoc>java -cp rhino\js.jar org.mozill a.javascript.tools.shell.Main -modules node_modules -modules rhino -modules lib -modules . Rhino 1.7 release 5 PRERELEASE 2014 10 17 js>The difference here being
java -cp rhino/js.jarversusjava -cp lib/js.jarwhich is stated in the README. I'm not sure if this is relevant to the fix or not.Here's the exact error:
Running tests... org.mozilla.javascript.EcmaError: ReferenceError: "self" is not defined. (file:/ C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/ca ptured_trace.js#464) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3689) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3667) at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3752) at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1793) at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1732) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1552) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/captured_trace.js:464) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/captured_trace.js:229) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/debuggability.js:27) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/async.js:84) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/async.js:91) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/async.js:14) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109) at org.mozilla.javascript.InterfaceAdapter.invokeImpl(InterfaceAdapter.java:137) at org.mozilla.javascript.InterfaceAdapter$1.run(InterfaceAdapter.java:83) at org.mozilla.javascript.Context.call(Context.java:489) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504) at org.mozilla.javascript.InterfaceAdapter.invoke(InterfaceAdapter.java:86) at org.mozilla.javascript.jdk13.VMBridge_jdk13$1.invoke(VMBridge_jdk13.java:132) at com.sun.proxy.$Proxy0.run(Unknown Source) at org.mozilla.javascript.Context.call(Context.java:489) at org.mozilla.javascript.Context.call(Context.java:451) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1473) at script.getCallback(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/rhino/rhino-shim.js:26) at script.setTimeout(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/rhino/rhino-shim.js:33) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/schedule.js:15) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/async.js:97) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/async.js:55) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/debuggability.js:15) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/promise.js:638) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/promise.js:503) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/promise.js:419) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/node_modules/bluebird/js/main/promisify.js#154(Function):29) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/cli.js:183) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/jsdoc.js:126) at script(file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/jsdoc.js:83) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120) at org.mozilla.javascript.commonjs.module.Require.executeModuleScript(Require.java:355) at org.mozilla.javascript.commonjs.module.Require.getExportedModuleInterface(Require.java:288) at org.mozilla.javascript.commonjs.module.Require.requireMain(Require.java:137) at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:525) at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:176) at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100) at org.mozilla.javascript.Context.call(Context.java:489) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504) at org.mozilla.javascript.tools.shell.Main.exec(Main.java:158) at org.mozilla.javascript.tools.shell.Main.main(Main.java:136) undefined- Windows 7 SP1 Build 7601
- I installed JSDoc via
git clone https://github.com/jsdoc3/jsdoc.git - Java Version,
CLASSPATH, andJAVA_HOME:
java version "1.7.0_76" Java(TM) SE Runtime Environment (build 1.7.0_76-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode) set CLASSPATH Environment variable CLASSPATH not defined set JAVA_HOME JAVA_HOME=C:\Program Files\Java\jdk1.7.0_76- JSDoc is installed at:
C:\Users\djthomps\Desktop\closure\sample4\jsdoc - After adding the code referenced in Can't run jsdoc on the included rhino bundle from Windows command line #533 (comment)
- I get
file:/C:/Users/djthomps/Desktop/closure/sample4/jsdoc/rhino/js.jar
- I get
- After running
java org.mozilla.javascript.tools.shell.MainError: Could not find or load main class org.mozilla.javascript.tools.shell.Main
Please let me know if there's any additional information you need!
1.) Download the latest jsdoc release; unzip to Desktop
2.) Open cmd.exe, "cd Desktop\jsdoc-master"
3.) "jsdoc --help"
Throws the exception:
???
Windows 7 SP1, 64-bit