Freitag, 25. Mai 2012

Offtopic: Mac can't resolve localhost and Eclipse Debug Mode does not work

I always had problems to run eclipse in debug mode.
Error: Invalid memory access of location 0x14 rip=0x########



After reading millions of forum posts i found out that it could be related to a other problem i had since a long time.
If i try to ping localhost, it says can't resolve localhost.


The problem is that /etc/hosts is empty.


You can check this by open the command line tool and write "sudo nano /etc/hosts" or "sudo vi /etc/hosts". If the file is blank you propably got the same problem like me. Good for you that i found a solution:


1. Open Command line
2. Copy that:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost



3. Type: "sudo nano /etc/hosts" or "sudo vi /etc/hosts"
4. If a blank file is show. Rightclick and Paste.
5. Save the File.
6. Try "Ping localhost"


Also Eclipse shoud now be able to run the Debugmode.

Troubleshooting:

You were trying to save the file but it failed because of "Error writing hosts: No such file or directory".
The Problem is that the file is a alias file and just references to nowhere.
Ok do Step 1 and 2. After that Type: "sudo nano /etc/hosts2" or "sudo vi /etc/hosts2".
Do step 4 and 5.
Than go to /etc/ and type "mv hosts hosts3" and "mv hosts2 hosts"
Go step 6. :)


OR


type: "rm /etc/hosts" and start from step1.

Keine Kommentare:

Kommentar veröffentlichen