‘Swap file "./.bash_profile.swp" already exists’ I'm trying to edit .bash_profile because I am installing the JDK on my Mac.

When trying to open up the file using vi ./.bash_profile, it shows an error because there was a swp file of bash. It also said there may be someone editing it or that a past session crashed. It gives me options to edit, recover or delete. So I recovered it and got this:

Swap file "./.bash_profile.swp" already exists! "./.bash_profile" 2L, 87C


What does that mean and how do I move forward? I need to edit the file and put in this command

export PATH=$PATH:/Library/Java/JavaVirtualMachines/ jdk1.8.0_91.jdk/Contents/Home/bin
Open the file with vi (vim):

vi .bash_profile


You will see a prompt like this:

[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:


Type the following at the prompt:

r


At the next prompt:

Press ENTER or type command to continue


Type:

:w savedfile


This will bring you into visual mode. Type:

:q!

to quit vim.

Now remove (unlink) the file .bash_profile.swp. You now can compare your original .bash_profile with savedfile and edit as necessary.