Freewind
Freewind

Reputation: 198318

Which parts or packages can be removed from JDK?

There are a lot of packages built in the jdk, and the size of jdk is biger and biger. But I found there are a lot of packages I never used, or they have a better 3rd party replacement.

So, which packages do you think can be removed from JDK, or we don't need to use them?

Upvotes: 1

Views: 174

Answers (3)

stacker
stacker

Reputation: 68972

The first thing that comes to my mind is the project Jigsaw I'm not sure whether it is still active, but should still be a good starting point.

Upvotes: 0

Stephen C
Stephen C

Reputation: 719159

So, which packages do you think can be removed from JDK, or we don't need to use them?

I don't think a cut down JRE is a good idea.

Lets think about the reasons why you might want a cut down JRE:

  • "The size of a JRE is getting bigger". But the size of hard disks is getting bigger more quickly.

  • "The size of JRE installers is getting bigger". But the speed of networks is getting faster more quickly.

  • "The JRE is using more and more memory". Most likely it isn't. A running Java application only loads the JRE classes that it actually uses. A command line "hello world" program does not pull in Swing, CORBA support, the XML parsers, or anything else that it doesn't use.

  • "But it is using too much memory". Really? If you think so, consider using Java ME .... and learn to live with the downside of a cut-down class library.

And to answer your question. I don't think any of them should be removed. They are all useful to a lot of people some of the time. And if any of these packages were removed, from the standard JRE it would break compatibility for many, many existing applications.

And the packages cost very little in the case where they are not actually needed. At least, not in most use-cases.


In reality, Sun/Oracle have done a lot of work to reduce footprints and improve JVM startup times. And last time I looked, more work on this was on the agenda for Java 8.


If you are considering doing this for yourself, here is some free advice:

DON'T DO IT.

IANAL, but I understand that creating and shipping a cut-down binary version of the JRE is a violation of the Java software license, and of the conditions under which you are permitted to use trademarked terms like Java, JRE and so on.

Upvotes: 3

aioobe
aioobe

Reputation: 421080

So, which packages do you think can be removed from JDK, or we don't need to use them?

Unless you mean this as an subjective question of what "we think is superfluous" (in which case the question should and will get closed quite quickly), you are the only one able to tell which packages you don't need.

I'm not sure though, why you would want to strip down the JDK. The JRE would perhaps make more sense to strip down on a system with really limited resources. If you wish to do this, Google provides many good urls.

Upvotes: 3

Related Questions