Ola,
Porque vc não tenta ler o arquivo com java mesmo?
Pode seguir esse tutorial aqui:
http://www.guj.com.br/java.tutorial.artigo.13.1.guj
Em todo caso, se quiser continuar fazendo da forma que está, tente:
Runtime.getRuntime().exec("notepad bancoDeDados\salvos.txt");
cara usa o pacote IO de java e seja feliz…
Se vc. quiser incrementar e abrir, no lugar do notepad, o editor registrado pelo usuário para edição de arquivos txt, use como comando o seguinte:
“cmd /c start <nome do arquivo>.txt”
Desta forma vc. não fica amarrado ao notepad em si.
Saudações.
Tenho tentado abrir um arquivo do bloco de notas que serve como um simples (mas muito simples mesmo) banco de dados através de uma aplicação swing.
A idéia é que o notepad execute e o arquivo abra quando o usuário clicar num item de menu.
Para isso tentei o seguinte;
Runtime.getRuntime().exec(“bancoDeDados\salvos.txt”);
Não funcionou, mas gerou uma longa exception descrita assim:
[color=darkblue]java.io.IOException:[/color] [color=darkred] Cannot run program “bancoDeDados/salvos.txt”: CreateProcess error=193, %1 não é um aplicativo Win32 válido
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at gui.Janela.miSalvosApertado(Janela.java:136)
at gui.Janela$4.actionPerformed(Janela.java:94)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by:[/color][color=darkblue] java.io.IOException[/color][color=darkred]: CreateProcess error=193, %1 não é um aplicativo Win32 válido
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
… 33 more[/color]
Gostaria muito de saber a forma correta de abrir um arquivo txt no notepad partindo de uma aplicação java.
Agradecido.