• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Edit File

 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I made little Swing program, I have also one button, now im wondering how to create this kind of function:

After Presing X button it should automaticaly open Hosts file, edit it, add some lines, and save.

Would be great if someone can help me, thanks in advice.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12203
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do you mean by "edit it' and "add some lines"?
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, anyway I made it:

 
Campbell Ritchie
Sheriff
Pie
Posts: 50284
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using StringTokenizer, which is a legacy class?
What is supposed to happen and what goes wrong? Please look at this FAQ.
Why are you doing anything to a file in system32?
Why have you written an empty catch block?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic