validator/grunt-html

Make it work on Windows

jzaefferer opened this issue · 32 comments

Supposedly its not working. Need to test at least once.

as Default:
Running "htmllint:all: task

Error; Error: not found: java

Although java is running on my windows 7 system.
-rich

I've tested it on my own Windows 7 machine and it works fine. I need more information to reproduce the issue.

Same problem on Win 8.1. Tried a fresh npm install in Windows default cmd with admin rights -- without success. I'm pretty sure it works on my Windows7 machine. I will try to verify that.

Any ideas?

Have you checked if you can run java --version outside of grunt on the command line?

See also this StackOverflow entry, which has comments asking the same question: http://stackoverflow.com/questions/20264628/grunt-htmllint-error-cant-find-java

This works:

$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

Just to be sure though, are you running grunt and java -version from the same command line?

Yes.

What happens if you run java -jar [path to jar] (drag and drop the actual JAR to be safer)?

This seems to work when using command line. I'm not sure what is meant with drag and drop?

$ java -jar node_modules/grunt-html/vnu.jar
Usage:

    java -jar vnu.jar [--entities] [--errors-only] [--no-stream]
         [--format gnu|xml|json|text] [--help] [--html] [--schema URL]
         [--verbose] [--version] FILES

    java -cp vnu.jar nu.validator.servlet.Main 8888

    java -cp vnu.jar nu.validator.client.HttpClient FILES

For detailed usage information, use "java -jar vnu.jar --help" or see:

  http://validator.github.io/

To read from stdin, use "-" as the filename, like this: "java -jar vnu.jar - ".

Well that is very strange....

Can you try this?

npm install which
node -e 'console.log(require("which").sync("java"));'

On my system that logs /usr/bin/java. You should get something...

Getting an error:

$ node -e 'console.log(require("which").sync("java"));'

d:\GIT\_jQuery\jquery-ui\node_modules\which\which.js:83
  throw new Error("not found: "+cmd)
        ^
Error: not found: java
    at Function.whichSync [as sync] (d:\GIT\_jQuery\jquery-ui\node_modules\which\which.js:83:9)
    at [eval]:1:30
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:532:25)
    at startup (node.js:80:7)
    at node.js:902:3

Is Java in your PATH?

No. I added it and tried a PATH var like this but without success:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\nodejs\;C:\Program Files (x86)\Java\jre7\bin

One question: do I need java AND javac (aka JRE or SDK)? It seems I've only installed the runtime.

You should only need the JRE

@fnagel did you ever get this resolved?

Nope, but I could try again... it worked before so...

Tried this again for datepicker (after merging master). Deleted node_modules directory and rerun npm install with admin privileges.

It still fails but I get a different error message:

Running "htmllint:all" (htmllint) task
>> Error: Exception in thread "main" java.lang.StackOverflowError
>>      at com.thaiopensource.relaxng.impl.DuplicateAttributeDetector.startChoice(Unknown Source)
>>      at com.thaiopensource.relaxng.impl.ChoicePattern.checkRestrictions(Unknown Source)

@fnagel the latest version should fix this problem

You may have to explicitly install this module if the version in package.json is out of date, so

npm install grunt-html

I've updated the jQueryUI package json to grunt-html 1.4.0 and did same installation process as described above. Same error.

Installing with npm install grunt-html doesn't help either.

WHich version of Windows, 64 or 32 bits? What version of Java and what architecture of java (32 or 64)

Windows: 8.1 Pro 64bit
Java: 1.7.0_55 32bit

This stack size thing is a nightmare...

@fnagel It would probably help a lot to install 64bits JRE on a 64bits system but I'll see if there something that can be done.

@jzaefferer perhaps we have to detect the Java architecture instead of the system one.

It would probably help a lot to install 64bits JRE on a 64bits system

That should be worth a try.

perhaps we have to detect the Java architecture instead of the system one.

My installed java responds to java -version (--version is unrecognized, ugh). Parsing this looks terrible:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Gonna reopen this anyway.

From my research, we have too look for 64-Bit Server VM If it's not present then it's 32bits

I've tried to change to 64bit architecture: installed 64bit, changed system path variable and rebooted -- command line still seems to use 32bit:

$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b14)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

I will give it another try by removing java completely and then reinstall it.

I have absolutely no clue why but grunt htmllint (testcase is jQuery UI master branch) works now.

I did not change anything java specific (since my last comment). Can somebody confirm it#s working on Windows 8.1?

Anyway, I'm happy as I'm finally able to run all tests for jQuery UI.

"Did you try turning it off and on again?"

Let's hope this is now resolved and we can leave this ticket closed.

We still need to add a fix to detect the Java version. That's an issue that come's up fairly often with our developers.