Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 2705

Summary: Wrong CLASSPATH of sun sdk1.4.0 stops me from running java apps
Product: Gentoo Linux Reporter: Miguel Sousa Filipe <miguel.filipe>
Component: New packagesAssignee: Karl Trygve Kalleberg (RETIRED) <karltk>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: 1.0   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Miguel Sousa Filipe 2002-05-13 13:29:20 UTC
[56p] tigre : ~ $ java-config --classpath  
/opt/sun-jdk-1.4.0/lib/rt.jar
[57p] tigre : ~ $ java-config --java-version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

--(tigre)-(pts1)-(22:08/14-May-02)--
--(m3thos#:~/cg)-- java Global s teapot teapot.bmp
Exception in thread "main" java.lang.NoClassDefFoundError: Global
--(tigre)-(pts1)-(22:16/14-May-02)--
--(m3thos#:~/cg)-- unset CLASSPATH
--(tigre)-(pts1)-(22:17/14-May-02)--
--(m3thos#:~/cg)-- java Global s teapot teapot.bmp
Erro Ao ler do ficheiro teapot, em LeFicheiro()
J&#65533; li do Ficheiro
Tem 0 Poligonos e 0 Arestas
J&#65533; fiz o rendering

has it's seen by this demo, I can't have java aplications working unless I unset
the $CLASSPATH environment variable.
And I don't seem to be able to unset that CLASSPATH permanently.
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-05-14 08:46:39 UTC
The reason this happens is that the default CLASSPATH does not have . in it, thus
CLASSPATH=/opt/sun-jdk-1.4.0/lib/rt.jar:.

I do not think adding this to the default CLASSPATH is such a good idea, as it
might result in unintended side-effects for various tools, especially if the "."
moves leftwards in the path-list.

You should configure your user's CLASSPATH in .bashrc or .zshrc or .tcshrc or
whatever by doing something like:
export CLASSPATH=${CLASSPATH}:. 
after you have sourced /env/profile

Please note that if you you use the preferred setup, with --set-user-classpath,
then source $HOME/.gentoo/java-env, this will not be an issue.

I will update the Java Guide to reflect this.