OpenJDK

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(New page: A version of JDK released under GPL open source license: wikipedia::OpenJDK.)
Line 1: Line 1:
A version of [[JDK]] released under [[GPL]] open source license: [[wikipedia::OpenJDK]].
A version of [[JDK]] released under [[GPL]] open source license: [[wikipedia::OpenJDK]].
 +
 +
It comes with various ''improvements'' over the classical [[Oracle]]'s [[JDK]] which often makes the [[OpenJDK]] much less usable than the original. One of the problems is the modified launcher parameters as described in [[Virtualization]] page. Instead of being helpful, it just makes the whole system unusable. However, at least the system starts.
 +
 +
For a while I've been struggling with java on my hosted [[Linux]] (Cent OS). Whenever I tried:
 +
 +
<source lang="bash">
 +
$ java
 +
Error occurred during initialization of VM
 +
Could not reserve enough space for object heap
 +
Could not create the Java virtual machine.
 +
</source>
 +
 +
Why? The system has a lot of resources, so where is the problem? It turned out that the workaround is easy. Just to limit the number of available memory:
 +
 +
<source lang="bash">
 +
$ java -mx64M
 +
Usage: java [-options] class [args...]
 +
(to execute a class)
 +
or java [-options] -jar jarfile [args...]
 +
(to execute a jar file)
 +
</source>
 +
 +
The question however is: How to modify each [[JDK]] utility ('''jar''', '''javac''', '''javadoc''', etc.) to use this changed setting? For a while I thought it is impossible, but today I realized that
 +
<source lang="bash">
 +
$ java -client
 +
</source>
 +
works too. From here it was just a step to symlink the server directory inside the [[JDK]] installation to client:
 +
<source lang="bash">
 +
# cd jre/lib/i386/
 +
# mv server/ server.bak/
 +
# ln -s client server
 +
</source>
 +
Now I can use all the [[JDK]] functionality without problems. However it took me a while to get there. No surprise nobody offers [[Java]] in [[Virtualization|virtualized]] environments, when it is so hard to set it up (and [[PHP]] is instantly ready).

Revision as of 08:53, 28 November 2010

A version of JDK released under GPL open source license: wikipedia::OpenJDK.

It comes with various improvements over the classical Oracle's JDK which often makes the OpenJDK much less usable than the original. One of the problems is the modified launcher parameters as described in Virtualization page. Instead of being helpful, it just makes the whole system unusable. However, at least the system starts.

For a while I've been struggling with java on my hosted Linux (Cent OS). Whenever I tried:

$ java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Why? The system has a lot of resources, so where is the problem? It turned out that the workaround is easy. Just to limit the number of available memory:

$ java -mx64M
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

The question however is: How to modify each JDK utility (jar, javac, javadoc, etc.) to use this changed setting? For a while I thought it is impossible, but today I realized that

$ java -client

works too. From here it was just a step to symlink the server directory inside the JDK installation to client:

# cd jre/lib/i386/
# mv server/ server.bak/
# ln -s client server

Now I can use all the JDK functionality without problems. However it took me a while to get there. No surprise nobody offers Java in virtualized environments, when it is so hard to set it up (and PHP is instantly ready).

Personal tools
buy