Utilize your network. Do you have any former classmates from college or former colleagues that have moved on to some of these "bigger and better" markets that you'd like to enter? If you worked with them on class projects so they know you were a hard-worker and smart, that always is a bonus. Give them a call or email, reconnect with them on facebook or linked in, etc. Ask them about where they're working now, what kinds of skills their employer is looking for, how they'd recommend getting your feet in the door, what kinds of projects they're working on, etc. At some point, you may even wish to ask if they'd be able to give you a tour of their office or if you could take them out to lunch the next time you're in town visiting.
Take A Vacation and Network in Person
If at all possible, take a "vacation" to one or more of your target markets. If you can coincide your visit with a professional group event where you'd have networking opportunities, all the better. Set up some lunch dates with people you know or have networked with to learn more about where they work. You may even want to stop by and visit the companies you are most interested in, in person, to get a better sense of their culture. Strike up conversations with strangers, you'll never know when you happen to talk to someone that happens to be married to a hiring manager at one of your target companies (yes, that happened to me once, it does happen!) or have some other useful connection. Let people know you're just checking out the area as you're thinking of relocating there.
Strategically Decide Where to Apply
Some companies, especially smaller companies, may not have a budget available for flying out candidates from all parts of the country for an interview, let alone paying for relocation expenses, and they can't be sure you'll like the climate, traffic, etc, so there's slightly more risk involved in interviewing a non-local candidate. Consider: Are you willing to front any of those costs yourself? Or do you only want to consider companies that will pay for your out of town interview or relocation expenses? If you can find out beforehand what attitude the company has about relocation, it may be a non-issue, or you may need to specifically address in your cover letter why you're applying despite their "local candidates only" blurb on the job description.
It's not you, there's just too many awesome candidates
Java and .Net developers are pretty much both a dime a dozen in hot markets, and I know nothing of new york, but in the bay area it's a down economy right now and there's just a lot more people looking for jobs than there are jobs available. Somehow you have to differentiate yourself from all these other people who would probably also be fantastic candidates (many of whom may be local too) that you're competing against. Leverage what you have, and market yourself well--why should they hire you over all those other guys? I'm sure there is a reason, it's just pinpointing what makes you shine so you can sell yourself well.
Take a Short-term Contract
Another option to consider is applying for shorter term contract-positions in your target market. They may not pay relocation, and they offer less long-term stability, so you may just end up putting most of your stuff in storage for a while until you decide whether you're staying there for good, but that might be the foot in the door you need to make networking in person in your target market affordable and give you time to make good contacts who can hook you up with an interview for permanent positions at other companies. And if you're really lucky, perhaps you'll land a contract-to-hire gig.