The default bug view has changed. See this FAQ.

Javascript example for Windows need double quotes to work, not single quotes

RESOLVED FIXED

Status

Developer Documentation
Mozilla Platform
RESOLVED FIXED
11 years ago
2 years ago

People

(Reporter: John Poole, Assigned: sheppy)

Tracking

Details

(Whiteboard: u=mozdev p=0 c=Platform, URL)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

The example, though working in Linux, does not work in Windows because of the single quotes:
G:\ws\rhino\examples>ver

Microsoft Windows XP [Version 5.1.2600]

G:\ws\rhino\examples>java RunScript "Math.cos(Math.PI)"
-1

G:\ws\rhino\examples>java RunScript 'function f(x){return x+1} f(7)'
functionf(x){returnx+1}f(7)

G:\ws\rhino\examples>java RunScript "function f(x){return x+1} f(7)"
8

G:\ws\rhino\examples>ver

Microsoft Windows XP [Version 5.1.2600]

G:\ws\rhino\examples>java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)

G:\ws\rhino\examples>

Reproducible: Always

Steps to Reproduce:
1. Open DOS console in directory of RunScript.class
2. Set CLASSAPTH to rhino class tree and current dir, "e.g. set CLASSPATH=../build/classes;."
3. run: java RunScript 'function f(x){return x+1} f(7)'
4. run: java RunScript "function f(x){return x+1} f(7)"


Actual Results:  
single quotes:
G:\ws\rhino\examples>ver

Microsoft Windows XP [Version 5.1.2600]

G:\ws\rhino\examples>java RunScript "Math.cos(Math.PI)"
-1

G:\ws\rhino\examples>java RunScript 'function f(x){return x+1} f(7)'
functionf(x){returnx+1}f(7)

G:\ws\rhino\examples>single quotes:
G:\ws\rhino\examples>ver

Microsoft Windows XP [Version 5.1.2600]

G:\ws\rhino\examples>java RunScript "Math.cos(Math.PI)"
-1

G:\ws\rhino\examples>java RunScript 'function f(x){return x+1} f(7)'
functionf(x){returnx+1}f(7)

G:\ws\rhino\examples>java RunScript "function f(x){return x+1} f(7)"
8
8

Expected Results:  
"8" should be output for: java RunScript "function f(x){return x+1} f(7)"

This is a documentation bug, and perhaps an oversight of the author about differences in DOS consoles vs. Linux.

[Sorry for the incorrect component assignment, I tried to find something that would associate this bug with the rhino project, but the online documentation within this bug filing process did not provide me the necessary information.]
*** Bug 352050 has been marked as a duplicate of this bug. ***
Severity: minor → normal
OS: Windows XP → All
Hardware: PC → All
Product: mozilla.org → Websites

Comment 2

9 years ago
The www.mozilla.org site should no longer host documentation.  If there is still a need for this it should be added to MDC.  Moving to Mozilla Developer Center product for discussion.
Component: www.mozilla.org → Documentation Requests
Product: Websites → Mozilla Developer Center
QA Contact: www-mozilla-org → doc-request
Version: other → unspecified

Comment 3

9 years ago
I've been slowly moving documents over to MDC, but haven't moved this one yet.
Component: Documentation Requests → Documentation
Product: Mozilla Developer Network → Mozilla Developer Network
Automatically closing all bugs that have not been updated in a while. Please reopen if this is still important to you and has not yet been corrected.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
Reopening for review by Sheppy.
Assignee: nobody → eshepherd
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Component: Documentation → General
Product: Mozilla Developer Network → Developer Documentation
(Assignee)

Updated

4 years ago
Whiteboard: u=mozdev p=0
(Assignee)

Updated

4 years ago
Component: General → Mozilla Platform
Whiteboard: u=mozdev p=0 → u=mozdev p=0 c=Platform
(Assignee)

Comment 6

4 years ago
I've done some fixes for this. Can someone check it out and see if this is done or if it needs more work?

https://developer.mozilla.org/en-US/docs/Rhino/Embedding_tutorial
Status: REOPENED → RESOLVED
Last Resolved: 4 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.