Access restriction on class due to restriction on required library rt.jar?

前端 未结 15 1718
忘掉有多难
忘掉有多难 2020-11-22 01:09

I\'m attempting to compile Java 1.4 code that was created by IBM\'s WSDL2Java on Java5 without recreating

15条回答
  •  名媛妹妹
    2020-11-22 01:38

    In the case you are sure that you should be able to access given class, than this can mean you added several jars to your project containing classes with identical names (or paths) but different content and they are overshadowing each other (typically an old custom build jar contains built-in older version of a 3rd party library).

    For example when you add a jar implementing:

    a.b.c.d1
    a.b.c.d2
    

    but also an older version implementing only:

    a.b.c.d1
    (d2 is missing altogether or has restricted access)
    

    Everything works fine in the code editor but fails during the compilation if the "old" library overshadows the new one - d2 suddenly turns out "missing or inaccessible" even when it is there.

    The solution is a to check the order of compile-time libraries and make sure that the one with correct implementation goes first.

提交回复
热议问题