views:

53

answers:

2

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?

+2  A: 

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.

Enno Shioji
I'm a little confused here. If I were to make a HelloWorld.java using notepad and compile it with javac from the command line then I wouldn't add have all these extra classpaths. It would be javac HelloWorld.java and java HelloWorld but Intellij adds like 10 things to the classpath. Surely, those aren't always in the classpath because they're part of the standard library if I were to use notepad and compile from the command line?
TJEnt
yes - they are in the classpath - they are part of the Java runtime, and are implicitly loaded. IntelliJ just makes these referenced libraries visible.
Kevin Day
Thanks for explanation kevin. If I could I'd upvote your comment but I guess I'm too new.
TJEnt
A: 

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.

Colin Hebert