Grazie mille, è esattamente ciò di cui avevo bisogno. Il problema ora è che non legge niente dal programma esterno. La variabile che uso per salvarmi la prima riga è sempre vuota, anche se nel programma non ci sono righe vuote. Sai come mai? Il programma che ho scritto io è il seguente :
codice:
import java.io.*;
import java.util.*;
import java.io.IOException;
public class richiamoprogramma {
public static void main(String[] args) throws IOException, FileNotFoundException {
int i=0;
File f = new File ("C:\\Users\\studenti\\Desktop\\");
String[] files = f.list();
i=0;
String nomeFile=files[i];
Process p= Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\ZBar Bar Code Reader\\ZBar Command Prompt.lnk");
InputStream is = p.getInputStream();
BufferedReader buff = new BufferedReader( new InputStreamReader(is) );
String linea = null;
linea=buff.readLine();
System.out.println( linea );