kompilieren Ich habe mein Java-Programm als Teil einer Uni-Zuordnung erstellt und als Teil der Einreichung muss es in einem DOS-Fenster kompiliert und ausgeführt werden können (Windows lesen Befehlsfenster). Das Programm läuft in Netbeans gut, aber wenn ich alle .java-Dateien in einen separaten Ordner kopiere und versuche, jeden zu kompilieren, bekomme ich eine große Anzahl von Kompilierungsfehlern. Als ich die Dateien in Netbeans erstellt habe, habe ich sie alle zu einem Paket zusammengefasst und Netbeans ein "package * Project_Name *" am Anfang jeder Klasse hinzugefügt. Der Rest ist Standard-Java, nichts zu komplex. ITs mein erstes Mal mit Netbeans (Version 7.1.1 ist was ich benutze) und es macht mich verrückt. Ich kann eine JAR-Datei erstellen, und ich kann das von der Befehlszeile ausführen, aber ich muss in der Lage sein zu zeigen, dass der Quellcode von der Befehlszeile kompiliert werden kann, und die resultierenden Datei (en) können auch als Befehl ausgeführt werden Linie. Hat jemand anderes dieses Problem gehabt, und wenn ja, wie haben Sie es überwunden oder weiß jemand, was zu tun ist, um dieses Problem zu lösen?Kann Netbeans generierte .java Dateien in .class auf der Kommandozeile
Ich habe ein Gefühl, seine Verweise auf andere Dateien zu tun, da die meisten der Fehler mit Objekten, die erstellt werden, und Methoden, die von anderen Dateien aufgerufen werden, verwandt sind. Zum Beispiel habe ich eine Manager.java-Datei, die Konstruktoren und Methoden für ein Manager-Objekt und dann in einer anderen Datei (sagen wir Proprety.java) Ich habe Code, um ein Manager-Objekt mit dem neuen Schlüsselwort zu erstellen.
Die aktuelle CLASSPATH Im mit ist
CLASSPATH =; C:. \ Programme \ Java \ jdk1.7.0_03 \ lib; C: \ Programme \ Java \ jre6 \ lib \ ext \ QTJava.zip ;
Die PATH-Variable eingerichtet ist, wie
...; C: \ Programme \ Java \ jdk1.7.0_03 \ bin; C: \ Programme \ Java \ jre7 \ bin
Und das ist es. Die einzigen Bibliotheken, die ich verwende, sind java.util. * Und java.io. * Alle anderen Verweise beziehen sich auf die Klassendateien, die ich in Netbeans erstellt habe.
Jede Hilfe wäre wirklich gut.
Ergebnisse SET-Befehl:
C:\>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Gunit\AppData\Roaming
asl.log=Destination=file
CLASSPATH=.;C:\Program Files\java\jdk1.7.0_03\lib;C:\Program Files\Java\jre6\lib
\ext\QTJava.zip;C:\Estateman
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=GUNIT-PC
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Gunit
LOCALAPPDATA=C:\Users\Gunit\AppData\Local
LOGONSERVER=\\GUNIT-PC
MOZ_PLUGIN_PATH=C:\Program Files\SumatraPDF\
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\syst
em32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v
1.0\;C:\Program Files\Common Files\Acronis\SnapAPI\;c:\Program Files\Microsoft S
QL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:
\Program Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\;C:\Progr
am Files\Common Files\Avid;Avid;C:\Program Files\doxygen\bin;C:\Program Files\Co
mmon Files\Adobe\AGL;C:\Program Files\Java\jdk1.7.0_03\bin;C:\Program Files\Java
\jre7\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 6 Stepping 5, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0605
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
QTJAVA=C:\Program Files\Java\jre6\lib\ext\QTJava.zip
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\Gunit\AppData\Local\Temp
TMP=C:\Users\Gunit\AppData\Local\Temp
USERDOMAIN=Gunit-PC
USERNAME=Gunit
USERPROFILE=C:\Users\Gunit
VS100COMNTOOLS=c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\
windir=C:\Windows
Befehl Im Lauf:
C:\Estateman>javac Manager.java
Ausgang:
Manager.java:33: error: cannot find symbol
Property temp0 = new Rental(24,"Bogan Ave","Geelong",3040,"Bob Jones
","0420685765","Victoria","Tues 8am",280.50,"23/4/2012");
^
symbol: class Property
location: class Manager
Manager.java:33: error: cannot find symbol
Property temp0 = new Rental(24,"Bogan Ave","Geelong",3040,"Bob Jones
","0420685765","Victoria","Tues 8am",280.50,"23/4/2012");
^
symbol: class Rental
location: class Manager
Manager.java:34: error: cannot find symbol
Property temp1 = new Selling(56,"Maritime Rd","Perth",6000,"Alan Gib
s","0400345964","Perth","Wed 3pm",350485.00);
^
symbol: class Property
location: class Manager
Manager.java:34: error: cannot find symbol
Property temp1 = new Selling(56,"Maritime Rd","Perth",6000,"Alan Gib
s","0400345964","Perth","Wed 3pm",350485.00);
^
symbol: class Selling
location: class Manager
Manager.java:35: error: cannot find symbol
Property temp2 = new Selling(901,"Preston Rd","Murdoch",6505,"Alan G
ibs","0400345964","Perth","Fri 10am",890000.00);
^
symbol: class Property
location: class Manager
Manager.java:35: error: cannot find symbol
Property temp2 = new Selling(901,"Preston Rd","Murdoch",6505,"Alan G
ibs","0400345964","Perth","Fri 10am",890000.00);
^
symbol: class Selling
location: class Manager
Manager.java:36: error: cannot find symbol
Property temp3 = new Rental(83,"Joke Way","Murdoch",6505,"Grace Kell
y","","Winthrop","Fri 1pm",475.00,"18/4/2012");
^
symbol: class Property
location: class Manager
Manager.java:36: error: cannot find symbol
Property temp3 = new Rental(83,"Joke Way","Murdoch",6505,"Grace Kell
y","","Winthrop","Fri 1pm",475.00,"18/4/2012");
^
symbol: class Rental
location: class Manager
Manager.java:37: error: cannot find symbol
Property temp4 = new Selling(167,"Joke Way","Murdoch",6505,"Bob Jone
s","0420685765","Victoria","Sat 3pm","17/5/2012");
^
symbol: class Property
location: class Manager
Manager.java:37: error: cannot find symbol
Property temp4 = new Selling(167,"Joke Way","Murdoch",6505,"Bob Jone
s","0420685765","Victoria","Sat 3pm","17/5/2012");
^
symbol: class Selling
location: class Manager
Manager.java:38: error: cannot find symbol
Property temp5 = new Selling(2,"Ashbury Lane","Success",6110,"Ian Fi
elder","0895484453","Atwell","Mon 11am",900000.00);
^
symbol: class Property
location: class Manager
Manager.java:38: error: cannot find symbol
Property temp5 = new Selling(2,"Ashbury Lane","Success",6110,"Ian Fi
elder","0895484453","Atwell","Mon 11am",900000.00);
^
symbol: class Selling
location: class Manager
Manager.java:54: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:54: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:84: error: cannot find symbol
Property temp = new Selling(num,name,sub,code,person,phone,offic
e,open,price);
^
symbol: class Property
location: class Manager
Manager.java:84: error: cannot find symbol
Property temp = new Selling(num,name,sub,code,person,phone,offic
e,open,price);
^
symbol: class Selling
location: class Manager
Manager.java:92: error: cannot find symbol
Property temp = new Rental(num,name,sub,code,person,phone,of
fice,open,price,vacant);
^
symbol: class Property
location: class Manager
Manager.java:92: error: cannot find symbol
Property temp = new Rental(num,name,sub,code,person,phone,of
fice,open,price,vacant);
^
symbol: class Rental
location: class Manager
Manager.java:156: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:156: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:165: error: cannot find symbol
Rental rTemp = (Rental)(temp);
^
symbol: class Rental
location: class Manager
Manager.java:165: error: cannot find symbol
Rental rTemp = (Rental)(temp);
^
symbol: class Rental
location: class Manager
Manager.java:173: error: cannot find symbol
Selling sTemp = (Selling)(temp);
^
symbol: class Selling
location: class Manager
Manager.java:173: error: cannot find symbol
Selling sTemp = (Selling)(temp);
^
symbol: class Selling
location: class Manager
Manager.java:180: error: cannot find symbol
Selling sTemp = (Selling)(temp);
^
symbol: class Selling
location: class Manager
Manager.java:180: error: cannot find symbol
Selling sTemp = (Selling)(temp);
^
symbol: class Selling
location: class Manager
Manager.java:198: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:198: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:199: error: cannot find symbol
Property tmp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:199: error: cannot find symbol
Property tmp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:212: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:212: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:238: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:238: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:239: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:239: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:249: error: cannot find symbol
((Property)(properties.get(i))).address.setStreetNum(num);
^
symbol: class Property
location: class Manager
Manager.java:250: error: cannot find symbol
((Property)(properties.get(i))).address.setStreetName(name);
^
symbol: class Property
location: class Manager
Manager.java:251: error: cannot find symbol
((Property)(properties.get(i))).address.setSuburb(sub);
^
symbol: class Property
location: class Manager
Manager.java:252: error: cannot find symbol
((Property)(properties.get(i))).address.setPostCode(code);
^
symbol: class Property
location: class Manager
Manager.java:266: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:266: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:273: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:273: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:280: error: cannot find symbol
((Property)(properties.get(i))).contact.setContact(name,phone,office
);
^
symbol: class Property
location: class Manager
Manager.java:296: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:296: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:311: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:311: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:317: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:317: error: cannot find symbol
Property temp = new Property();
^
symbol: class Property
location: class Manager
Manager.java:320: error: cannot find symbol
((Property)(properties.get(i))).viewing.setTime(time);
^
symbol: class Property
location: class Manager
Manager.java:332: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:332: error: cannot find symbol
Utils u = new Utils();
^
symbol: class Utils
location: class Manager
Manager.java:341: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
Manager.java:341: error: cannot find symbol
Property temp = (Property)(itr.next());
^
symbol: class Property
location: class Manager
57 errors
C:\Estateman>
Vielen Dank im Voraus
setzen Sie einen entsprechenden Classpath? Sie liefern keine wirklichen Informationen, die wir verwenden können, um zu helfen. –
Sie sollten einige grundlegende Informationen zu den verwendeten Klassen angeben. Legen Sie den richtigen Klassenpfad fest? Benutzt du Bibliotheken? – dexametason
Die Dateien, die ich zu kompilieren versuche, befinden sich in C: \ Estateman – gwunta