Originally Posted by
Norm
If the java program uses GUI then it will open a window for input however it is executed allowing user interaction.
If the java program only uses the console, then the user must open a comand prompt window to enter data into the program and see what it prints out.
On Windows, using a batch file (.bat) to execute the java program will open a command prompt window allowing user interaction.
Another option would be to use the JOPtionPane class. I will present a small window and get input without a swing GUI.
ok
about my original question how add text in remote text on FTP:
after struggles its work now, maybe its will help others(i learn simple regex for this hh)
and read beforce i write (for saving manually the old text, append fuction not working well i try so so many... so its do it yourself kind a thing):
URL urlR = new URL(banlist);
URLConnection conR = urlR.openConnection();
BufferedReader inR = new BufferedReader(new InputStreamReader(conR.getInputStream()));
String copyBanList = ""; //empty string
while ( (line = inR.readLine()) != null ) copyBanList += "\n" + line.trim(); //after read line(with trim), do new line
inR.close();
if(!targetIsAdmin && !targetInBan) {
URL urlW = new URL(banlist);
URLConnection conW = urlW.openConnection();
BufferedWriter outW = new BufferedWriter(new OutputStreamWriter(conW.getOutputStream()));
//add into copyBanList new line if i'ts not the first one
outW.write((copyBanList + "\n" + mac.replaceAll("\n+", "\n")).replaceAll("^\n+", ""));
outW.flush();
outW.close();
System.out.println("NOTICE: you have added the client" + " " + mac + " " + "to the banlist");
} else if(targetIsAdmin && !targetInBan) System.out.println("EROR: you can't give ban to admin!");
else System.out.println("EROR: the target:" + " " + mac + " " + "is already on ban list");