PDA

View Full Version : [JAVA] Problema configurazione CLASS PATH su Ubuntu


Re_Kotc
15-11-2007, 18:33
Ciao a tutti, sto cercando invano di configurare Java su Ubuntu per poter programmare direttamente da terminale, pensavo di aver installato correttamente tutto infatti dando il comando java -version ottengo
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

solo che scrivendo anche un programma stupido come hello world ottengo come errore ( in fase di esecuzione non in compilazione ) :

Exception in thread "main" java.lang.NoClassDefFoundError:

Cercando in giro ho capito che si tratta di impostare correttamente il classpath ..solo che non ho idea di come si faccia! pur avendo cercando in vari siti mi sono perso, sapete spiegarmi come fare? grazie mille

thehuge
15-11-2007, 19:31
Prendo direttamente da man java
-cp classpath
Specifies the path that java uses to look up classes. This overrides the default or CLASSPATH environment variable, if it is set. The system appends the location of the system classes onto the end of path. Directories are separated by colons. Thus, the general format for path is:
.:
For example:
.:/home/avh/classes:/usr/local/java/classes

Se il problema è come settare la variabile d'ambiente CLASSPATH:export CLASSPATH=.:/path/to/classes