Obama hails Americans, military on Fourth of July