无法在Windows框中安装WWW :: HtmlUnit

时间:2011-05-03 20:50:23

标签: java perl classpath htmlunit

我正在尝试在Windows 7上安装WWW::HTMLUnit。我已经完成了一步:

  1. 安装Inline :: Java 0.53
  2. 安装WWW :: HTMLUnit 0.15
  3. 在第2步,在nmake之后,我输入nmake test来测试模块但是它失败了。这是输出:

    C:\nmake test
    
    Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
    t/00_basic...........
    t/00_basic...........NOK 1/1#   Failed test 'use WWW::HtmlUnit;'
    #   at t/00_basic.t line 9.
    #     Tried to use 'WWW::HtmlUnit'.
    #     Error:  Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
    # BEGIN failed--compilation aborted at (eval 4) line 2, <GEN7> line 4.
    # Looks like you failed 1 test of 1.
    t/00_basic...........dubious
            Test returned status 1 (wstat 256, 0x100)
    DIED. FAILED test 1
            Failed 1/1 tests, 0.00% okay
    t/01_hello...........Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
    BEGIN failed--compilation aborted at t/01_hello.t line 4, <GEN7> line 4.
    t/01_hello...........dubious
            Test returned status 26 (wstat 6656, 0x1a00)
    t/02_hello_sweet.....dubious
            Test returned status 19 (wstat 4864, 0x1300)
    t/03_clickhandler....Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
    BEGIN failed--compilation aborted at t/03_clickhandler.t line 6, <GEN7> line 4.
    t/03_clickhandler....dubious
            Test returned status 29 (wstat 7424, 0x1d00)
    DIED. FAILED tests 1-8
            Failed 8/8 tests, 0.00% okay
    Failed Test         Stat Wstat Total Fail  List of Failed
    -------------------------------------------------------------------------------
    t/00_basic.t           1   256     1    1  1
    t/01_hello.t          26  6656    ??   ??  ??
    t/02_hello_sweet.t    19  4864    ??   ??  ??
    t/03_clickhandler.t   29  7424     8   16  1-8
    Failed 4/4 test scripts. 9/9 subtests failed.
    Files=4, Tests=9,  3 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)
    Failed 4/4 test programs. 9/9 subtests failed.
    NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x1d'
    Stop.
    

    从上面的日志中,我可以看到:

      

    类错误:无法找到com.gargoylesoftware.htmlunit.WebClient。

    我不知道我错过了什么。 任何帮助将不胜感激。

    感谢。 胡志明市。

2 个答案:

答案 0 :(得分:1)

我找到了。 Unix和Windows系统之间的路径有所不同。 Unix使用':'作为分隔符,但Windows使用';'。所以我所做的就是打开HTMLUnit.pm并将所有':'改为';'。 使用HTMLUnit版本0.15,我在以下这些行进行了更改: 第78行:

return join ';', map { "$jar_path/$_" } qw( # return join ':', map { "$jar_path/$_" } qw(

第127行:

$custom_jars = join(';', @{$parameters{'jars'}}); # $custom_jars = join(':', @{$parameters{'jars'}});

第148行:

CLASSPATH => collect_default_jars() . ";" . $custom_jars, # CLASSPATH => collect_default_jars() . ":" . $custom_jars,

它就像魔术一样。

答案 1 :(得分:1)

(它不会让我对现有答案发表评论)

我看到你关于':'vs';'的回答。我将尝试在下一个WWW :: HtmlUnit版本中包含一个修复程序(我是perl绑定的作者)。