[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The evils of /usr/share/java/repository



On Sun, Sep 16, 2001 at 02:16:58PM -0700, Per Bothner wrote:
> jeff wrote:
> 
> >Why not just put the jars in /usr/share/java, keep the system classpath
> >completely clean, and let the startup scripts for individual apps choose 
> >which
> >to include?
> >
> Because you're causing a big hassle for anybody writing a Java
> program, even "hello world".

I can write a Hello World program just fine with a completely blank
classpath [1]. In fact, I can write any program that uses java.* and
javax.* with nothing in the classpath except the package root.

> It is one thing to ask packagers to have to explicitly specify
> dependencies, but it is ridiculous to ask this
> of anybody who wants to program in Java for internal use.

Let's just suppose that some crazy people disagree with you, and don't
want miscellaneous libraries in their classpath. Suppose these people
have been burnt by class version conflicts. Suppose these people get
upset when moving their program to a different system, and finding they
were unwittingly relying on some jar.

You've now taken away the *choice* of those people. If the classpath was
left blank, developers are free to include the following in their
personal .bash_profile:

for i in /usr/share/java/*.jar; do
	export CLASSPATH=$CLASSPATH:$i
done

However, by doing it in the /usr/bin/java script, everyone is stuck with
it.

Now, are you feeling omniscient enough to declare that this will be fine
with *all* developers out there? That there will *never* be a situation
where an empty classpath is required?

> We don't do this for C or C++.

I wonder why that is.. I don't remember using a 3rd party package beyond
the STL.

--Jeff


[1] 
[jeff@kermit jeff]$ unset CLASSPATH
[jeff@kermit jeff]$ cat > Hello.java
public class Hello {
    public static void main(String args[]) {
        System.out.println("Hello world");
    }
}
[jeff@kermit jeff]$ javac Hello.java
[jeff@kermit jeff]$ java Hello
Hello world




Reply to: