If you start looking for a new job at the end of June and don't find one, are you still leaving your current job at the end of July? If the answer is no, then for sure don't talk to your boss, since that gives him power over the timing of your leaving.
But, if you are sure you are leaving, and you have a great relationship with your boss, I'd go ahead and give him the notice that you feel good about. Sounds like *someone* has to do your job, and you are the only one there and are good at it (since your relationship with your boss is good). From his perspective, he will want you to stay and probably won't fire you on the spot (unless the situation is as soccerluvof4 describes and you are privy to supersecret stuff and become an instant liability). A good boss will want a smooth transition for the end client and I for one would be thankful for longer than two weeks and a chance for the guy going out to train the employee taking over.