Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to edit hosts file in windows7 using java program ?

 
kumar prathi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How to edit the hosts file of windows7 using java program .

Any one please help me regarding this.
 
Tim Moores
Bartender
Posts: 2954
46
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That file is a file like any other. What particular difficulty are you having (assuming that the account your code runs under has access rights to it)?
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, Windows 7 and Vista have User Access Control (UAC) enabled by default. This will usually ask you for permission if you want to make any changes to system files and folders, and the hosts file is one of them. Unfortunately, some programs do not trigger the permission dialog, and access simply fails. Java is one of these applications.
 
kumar prathi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Well, Windows 7 and Vista have User Access Control (UAC) enabled by default. This will usually ask you for permission if you want to make any changes to system files and folders, and the hosts file is one of them. Unfortunately, some programs do not trigger the permission dialog, and access simply fails. Java is one of these applications.




is there any other ways to edit hosts file using java in windows 7?


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic