Why does IntelliJ import extra libraries from JDK 1.6 for a simple hello world program?

可紊 提交于 2019-12-11 07:20:00

问题


I'm new to Java and IntelliJ and I am just doing a simple "hello world" program. IntelliJ has about 10+ libraries from JDK 1.6 added to my project even though I'm not importing anything in my classes that would seem to need them. I created a new project from scratch.

Some of the libraries are alt-rt.jar, charsets.jar, deploy.jar, dnsns.jar, javaws.jar, jce.jar, jsse.jar, localedata.jar, etc.

Can anyone explain why those libraries were added? Can I remove those libraries from the Module Settings/SDK with no ill effect?


回答1:


They will be in the classpath anyways as they are part of the standard library. I'm not sure what will happen if you remove them, but you definitely don't need to do that.




回答2:


These libraries aren't imported in your project, intelliJ has just parsed these jar to see what were the accessibles classes (for auto-completion) with the default classpath.

They won't be packaged with your project.

Plus as your JDK (or any SDK for what it worth) is defined for intelliJ and not for your project only, every project you will create in the future will use the already parsed data from your JDK.



来源:https://stackoverflow.com/questions/3903475/why-does-intellij-import-extra-libraries-from-jdk-1-6-for-a-simple-hello-world-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!