private vs. public JRE in different OSs

L

lbrtchx

~
The installation instructions for the JDK for Linux and Windows:
~
http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html
~
http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html
~
give a different account in regards to the need and difference of
private vs. public JREs
~
Why is that?
~
What could you do without the private JRE? Just compile POJOs? What
are the tools that need the private JRE?
~
Why don't browsers using the "public JRE" use the "private" copy?
~
Thanks
lbrtchx
 
M

Martin Gregorie

~
The installation instructions for the JDK for Linux and Windows:
~
http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html
~
http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html
~
give a different account in regards to the need and difference of
private vs. public JREs
~
Why is that?
Remember that, unlike Windows, Linux is a true multi-user system.

You have the choice of installing the JRE in /usr/java where its publicly
available to any user or in a user's private space where only that user
can access it.
~
What could you do without the private JRE?
Use a publicly installed JRE.
Just compile POJOs?
That depends on what classfiles are in the CLASSPATH you're using.
What are the tools that need the private JRE?
You're missing the point. Normally a JRE is installed so all users get
access, but you might want to install a different JRE + JDK privately.
The usual reason for this is so the impact od a Java upgrade can be
evaluated without affecting anybody else's Java development environment
or any production code running on that host. For instance if everybody is
on 1.4 but you're considering an upgrade to Java 6 this is the way to
find what, if any effect the upgrade might have
~
Why don't browsers using the "public JRE" use the "private" copy?
Depends where they're being run. If its being run by a user with a
privately installed JRE the browser will use that. If its being run in
some other user, then the publicly installed JRE will be used - unless
they too happen to have a private JRE installed.
 
N

neuneudr

Every time this F.A.Q. is raised here, the answer usually
boils down to "the JDK uses a private JRE because the docs
say it will." Usually a link is provided to the language spec.

I *dare* someone to explain what bad thing might happen if
the JDK tools used the public JRE, and if the JDK only
shipped the single, public JRE in the bundle. In fact
I double-dare you!

Don't know if it has anything to do with security but...

A default Java install on a Un*x system does NOT mandate
to be the admin (i.e. "root") while a default Windows
install forces you to give the admin account.

As a security measure every single Java VM I install on
a server is installed in a user account. I just set up
a dedicated server (for a client of mine) running Tomcat.
Both the JVM and Tomcat are installed in a user account
and Linux's iptables is used to transparently redirect
request to the privileged ports 80 and 443.

The reason to install a "private" JVM on linux is
simple: security. There is simply no compelling reason
to install the JVM and Tomcat and to run them as root
when they can be installed in a dumb user account.

Could this be something similar for Windows?

I *know*, for having been bitten by that, that you
cannot install the "regular" JRE without being the
admin on an XP system... Could this be that the
"private JRE" can be installed without needing to
be the admin of the machine? For that would be
a *very* compelling reason to have a "private JRE".

Driss
 
E

Eric Sosman

Wayne said:
[...]
I *dare* someone to explain what bad thing might happen if
the JDK tools used the public JRE, and if the JDK only
shipped the single, public JRE in the bundle. In fact
I double-dare you!

Suppose you're running happily with Java 1.X -- JDK,
browsers, WebStart, everything in sight, they're all using
the shared JRE. Which is, as I said, Java 1.X.

Java 1.Ybeta becomes available, and you'd like to try it
out and see if the new Shakedown framework (it's a lot like
Collections, but more, um, robust) is worth using. If you're
dogmatic about having only one JRE on your system and sharing
it with everything, then you're stuck with the prospect of
migrating *everything* to Java 1.Ybeta all at once, even if
it turns out to be soggy slow and bug-infested ...

However: Once the final Java 1.Y comes out and you decide
you're comfortable with it, you *can* get your JDK to use the
same JRE as everything else does. The installation won't set
it up for you that way all unaided, but if you're a capable
sort of person you can do some post-installation surgery and
then get rid of one or the other of the JRE's. Myself, I feel
it's not worth the effort: The JRE weighs in at 85MB, and I've
got 89GB of unused disk space on the machine I'm using at this
moment. Increasing my free space by less than 0.1% just ain't
worth dithering over.

CPU cycles, RAM bits, and disk space were scarce and
expensive when I got into this industry. All three are now
cheap and plentiful, and the parsimonious habits developed
during the time of scarcity are now hard to justify -- also
hard to shake, but that's a rant for another time.
 
L

lbrtchx

Eric,
~
wasn't the JAVA_HOME environment variable devised for the kind of
problem you are describing?
~
I would have jre and/or jdk installations in different paths and then
simply go when the OS starts up:
~
export PRE_PATH=$PATH
~
and then each time I would like to (re)set the java version:
~
export JAVA_HOME=<whicever new path to it>
export CLASSPATH=<whicever new classpath (if necessary)>
export PATH=$JAVA_HOME/bin:$PRE_PATH
~
you could also easily also reset (or not) browsers ...
~
lbrtchx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top