HI...ich bin noch ein totaler neuling in java und wollte euch fragen wie man den classpath setzt...
also ich hab meine eigenen programme in C:\klassen\aufgaben und dann die Beispielprogramme in C:\klassen\Beispiele...
ich hab den classpath wie folgt gesetzt:
set CLASSPATH=.;C:\klassen\Beispiele\BspJaSP.zip
die zip-datei enthällt alle programme
Aber jetzt kommt folgender Fehler beim ausführen des Programms:
Code:
Ganzzahl.java:13: cannot access EM
bad class file: z:\klassen\EM.java
file does not contain class EM
Please remove or make sure it appears in the correct subdirectory of the classpath.
int g1=EM.liesInt();
Was hab ich falsch gemacht und wie mache ich das richtig?
ich hab das gerade in der konsole eingegeben und jetzt kommt folgendes wenn ich das programm ausführ:
Code:
Ganzzahl.java:13: cannot find symbol
symbol : variable EM
location: class Ganzzahl
int g1=EM.liesInt();
^
Ganzzahl.java:15: cannot find symbol
symbol : variable EM
location: class Ganzzahl
int g2=EM.liesInt();
die EM variable ist in der EM.java Datei und die is in der BspJaSp.zip enthalten...
und mein programm sieht folgend aus:
Code:
// Datei XX.java
/* ------------------------------------------------------------------------
Dieses Programm XX leistet Folgendes:
------------------------------------------------------------------------ */
class Ganzzahl {
// ---------------------------------------------------------------------
static public void main(String[] sonja) {
while(true){
pln("Geben sie den ersten Wert ein!" );
int g1=EM.liesInt();
pln("Geben Sie den zweiten Wert ein!");
int g2=EM.liesInt();
if(g1==0||g2==0){
break;
}
pln("g1+g2=" + (g1+g2));
pln("g1-g2=" + (g1-g2));
pln("g1*g2=" + (g1*g2));
pln("g1/g2=" + (g1/g2));
pln("g1%g2=" + (g1%g2));
}
} // main
// ---------------------------------------------------------------------
// Eine Methode mit einem kurzen Namen:
static void pln(Object ob) {System.out.println(ob);}
// ---------------------------------------------------------------------
} // class XX