wsz66
V2EX  ›  Java

一个关于 [ Java +guava] 的问题想请教一下

  •  
  •   wsz66 · Oct 12, 2019 · 3687 views
    This topic created in 2426 days ago, the information mentioned may be changed or developed.
    我有段代码是
    ```
    System.setProperty("webdriver.gecko.driver", new File(new File(this.getClass().getResource("/").getPath()).getParent()).getParent() + "\\tools\\geckodriver.exe");//设置 geckodriver 所在路径
    System.out.println(System.getProperty("webdriver.gecko.driver"));
    FirefoxProfile profile = new FirefoxProfile();
    ```
    然后跑到第三句会报 [ Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V ] 这个错误,请问有人遇到过吗
    7 replies    2019-10-12 14:55:38 +08:00
    xionghongzhi
        1
    xionghongzhi  
       Oct 12, 2019
    建议 google. 检查一下你的 jar 包是不是有冲突.
    xuanbg
        2
    xuanbg  
       Oct 12, 2019
    应该是包的版本不对,没有 checkArgument 这个方法。
    Raymon111111
        3
    Raymon111111  
       Oct 12, 2019
    NoSuchMethodError 一般都是包冲突, 你全局搜一下 com.google.common.base.Preconditions 看看是不是有两个.
    wsz66
        4
    wsz66  
    OP
       Oct 12, 2019
    @xionghongzhi
    @Raymon111111 谢谢,我看一下
    wsz66
        5
    wsz66  
    OP
       Oct 12, 2019
    @xuanbg 有可能,因为代码是别人给我的,他给的时候不是最新的,我换个版本试试
    jie170601
        6
    jie170601  
       Oct 12, 2019
    上次遇到这个报错是 maven 下包下残了,删了重下解决,也不知道为什么我这网 maven 经常下个 170 字节的 jar 包
    wsz66
        7
    wsz66  
    OP
       Oct 12, 2019
    @jie170601 还有这操作
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4988 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 09:43 · PVG 17:43 · LAX 02:43 · JFK 05:43
    ♥ Do have faith in what you're doing.