I am building a client server application using Java Sockets (in Windows XP).
For that I need different consoles for both Client and Server(for Input and Output operations). But in eclipse both share a single console. Is there any plugin or some sort of cheat through which I can do this.
After googling I got this,
http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg17138.html
But, this seems to be only for write operations, not read operations.
Also, I tried the following to launch application manually,
but even this is not working........
package mypack;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class MySystem {
public static void changeStream(String mainFile) throws IOException{
File temp = new File(".") ;
String parentPath = temp.getCanonicalPath() ;
System.out.println(parentPath);
//creation of batch file starts here
try{
File f = new File(parentPath + "\\a.bat") ;
System.out.println("Created : " + f.createNewFile());
//f.deleteOnExit() ;
FileOutputStream fos = new FileOutputStream(f) ;
String str = "java " + mainFile ;
String batchCommand="@echo off\n"+str+"\npause\nexit";
char arr[] = batchCommand.toCharArray() ;
System.out.println(str) ;
for(int i = 0 ; i < arr.length ; i++){
fos.write(arr[i]) ;
}
fos.close() ;
}
catch(Exception e){
}
//creation of batch file ends here
//execution of batch file starts here
try{
Runtime r = Runtime.getRuntime() ;
System.out.println(parentPath + "\\a.bat") ;
Process p = r.exec(new String[]{"cmd","/k","start a.bat"},null,new File(parentPath)) ;
OutputStream os = (OutputStream)p.getOutputStream() ;
System.setOut( new PrintStream(os) ) ;
System.out.println("Hello");
}
catch(Exception e){
e.printStackTrace();
}
//execution of batch file ends here
}
public static void main(String[] args) throws IOException {
MySystem.changeStream("MySystem") ;
}
}