[Tex/LaTex] Bad formatting using URLs in bibtex

bibliographiesbibtexurls

Is there a better way to include URLs in bibtex which result in a fine formatting? At the moment I do the following:

@misc{jvmti,
  author        = {Oracle},
  title         = {{JVM TI Reference}},
  howpublished  = {WWW page},
  year          = {2007},
  url           = {http://download.oracle.com/javase/6/docs/platform/jvmti/jvmti.html},
  note          = {\url{http://download.oracle.com/javase/6/docs/platform/jvmti/jvmti.html}},
  abstract      = {},
}

This results in this very long URL and above are all the rest of information but stretched over the whole line with a lot of white spaces due to justification.

Best Answer

I've had the same problem with URLs, the way I fixed it was adding the following commands to my preamble:

\usepackage{etoolbox}
\apptocmd{\thebibliography}{\raggedright}{}{}

Which tells LaTeX it's ok to have lines that don't span the whole text width in the bibliography.