I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. Where the fear has gone there will be nothing. Only I will remain.
(Zou er na de prompt een escape char staan ???)
Wat gebeurt er al laat je ook de volgende line printen?
"Ik heb zo veel soep gegeten, dat kan een mens niet aan. Ik heb zo veel soep gegeten, kan bijna niet meer staan. Ik zat daar maar te slurpen achter die grote kop en als ik bijna klaar was, dan schepten ze weer op!" (Hans Teeuwen)
Het ingegeven commando wordt door de parser verwerkt. Pas nadat het commando verwerkt is, mag hij de prompt terug tonen.
voorbeeld van gewenste output:
> start
Server started
>
De tekst "server started" wordt door de parser getoond
werkelijke ouput (in dosbox):
>start
>
Het is dus waarschijnlijk zo dat de variable "enteredCommand" niets bevat en dus een lege string naar mijn parser wordt doorgegeven...
Het rare van dit probleem is dat hij het wel correct doet in de console-window van JBuilder (dus als ik er geen .jar file van maak en het niet run in dos)
I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. Where the fear has gone there will be nothing. Only I will remain.
Na het programma verder te debuggen ben ik tot de constatie gekomen dat de applicatie wel degelijk de input binnenkrijgt.
De variabele 'command' wordt goed ingevuld en doorgegeven aan de parse()-method.
Het is nu juist in die method dat het verkeerd loopt:
1
2
3
4
5
6
7
| public void parse(String command) throws SyntaxException, IOException { // splits het commando in COMMANDO en ARGUMENTEN components = command.split(" "); System.out.println("parsing: " + components[0]); ... |
De System.out.println() wordt hier nu niet uitgevoerd, of tenminste, er wordt niets getoond (bij het uitvoeren van het app in een dosbox tenminste)
die components[] is toch een gewone String-array met als eerste element het commando dat je hebt ingetypt ?
I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. Where the fear has gone there will be nothing. Only I will remain.
FireFox - neem het web in eigen hand
P II 233 @ begane grond, rip (1997-2007), vervangen door vituele server uptime,
Of ben ik heel erg in de war met C
Look, runners deal in discomfort. After you get past a certain point, that’s all there really is. There is no finesse here.
/edit: Deze dus:
public PrintWriter(OutputStream out, boolean autoFlush)
Create a new PrintWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.
Parameters:
out - An output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer
[ Voor 73% gewijzigd door Mitt3nz op 09-02-2003 02:55 ]
'k Ga nog een beetje moeten verder debuggen waarschijnlijk
I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. Where the fear has gone there will be nothing. Only I will remain.