This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to edit hosts file in windows7 using java program ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to edit hosts file in windows7 using java program ?" Watch "how to edit hosts file in windows7 using java program ?" New topic
Author

how to edit hosts file in windows7 using java program ?

kumar prathi
Greenhorn

Joined: Nov 14, 2011
Posts: 17
Hi all,

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

Any one please help me regarding this.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Oct 27, 2005
Posts: 19655
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
kumar prathi
Greenhorn

Joined: Nov 14, 2011
Posts: 17
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?


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to edit hosts file in windows7 using java program ?
 
Similar Threads
How to get site name?
Edit File
javac: no classpath found
Glassfish server3.0 start failed in Windows7
how to edit hosts file in windows7 using java program ?