Olá pessoal.
A minha duvida é a seguinte:
Tenho que fazer um editor TCL/TK, com uma função de executar o código escrito na JTextArea. Só que o que ocorre é o seguinte. Quando eu salvar ou abir um arquivo com o JFileChooser no C:\ e mando ele executar funciona normalmente,mas só que se eu salvar em outro lugar ele nao roda de jeito nenhum. Dá um erro de :
couldn't read file "C:\Documents and Settings\Fabiano\Meus documentos\arquivo.tcl" : no such file or directory
Só funciona se eu abrir e salvar no C:\ em outra pasta nao funciona nem a pau.
Códigos
private void getExec(){
try {
String camh = "wish83 "+caminho+"/"+nomearq;
Runtime rt= Runtime.getRuntime();
rt.exec(camh);
} catch (IOException e1) {
e1.printStackTrace();
}
}
private void bAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAbrirActionPerformed
// TODO add your handling code here:
String line_str;
try{
javax.swing.JFileChooser arquivo = new javax.swing.JFileChooser();
arquivo.addChoosableFileFilter(new MyFilter());
if(arquivo.showOpenDialog(arquivo) == javax.swing.JFileChooser.APPROVE_OPTION){
File file = arquivo.getSelectedFile();
nomearq = arquivo.getName(file);
caminho = arquivo.getCurrentDirectory().getPath();
String textoEntrada = "";
java.io.FileInputStream isTwo = new java.io.FileInputStream( "" +file.getPath() );
java.io.DataInputStream dsTwo = new java.io.DataInputStream(isTwo);
dados.removeAllElements();
while((line_str = dsTwo.readLine()) != null){
dados.add( line_str + " " );
textoEntrada += line_str + "\n";
}
AreaTexto.setText( textoEntrada );
dsTwo.close( );
}
}catch (java.io.IOException e) {
javax.swing.JOptionPane.showMessageDialog( null, "File error: " + e.toString() );
}
}//GEN-LAST:event_bAbrirActionPerformed
Grato desde Já