File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 19672
    
  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 ?