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

前端 未结 15 1732
忘掉有多难
忘掉有多难 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:15

    I have been getting this error too, but my project is built on the command line using Maven and the tycho compiler (it's a set of OSGi plugins). After masses of sifting through people having the same problem but fixing it in Eclipse rather than on the command line, I found a message on the Tycho developer forum that answered my question, using configuration in pom.xml to ignore the compiler warning about the access restriction:

    
        org.eclipse.tycho
        tycho-compiler-plugin
        ${tycho.version}
        
            -warn:+discouraged,forbidden
        
    
    

    More information can be found in the Tycho FAQ. This took me AGES to work out, so I figured I would assist anyone else trying to fix these access restriction errors from the command line by posting this answer.

提交回复
热议问题