title: How To Open Files With .Jar (Java) Application?
body: <p>Tough question here. How do you open a file in java, in the way that when you double click on the file it automatically opens in a java application.</p>
  
  <p>I'm making a musicplayer (first real big Java project for me) and I have no clue how to acheive this. When you open, lets say, a .mp3 file it will open in whatever default program you have selected for it (such as VLC mediaplayer or Windows Media Player). What I want is to be able to set the .jar file of my application as the default program for .mp3 files, and then to be able to actually launch the files in the application.</p>
  
  <p>When I currently try to open a file with the application I get a windows error saying "This app cannot be executed on your pc". But when I launch the .jar itself without doing it by trying to open a .mp3 file it runs just fine.</p>
  
  <p>Does anyone  know how to acheive what I want? Many thanks in advance!</p>
  
  <p>---edit---</p>
  
  <p>I do not mean that you can select a default program for the mp3 file. The problem is that windows throws the error shown above, and that I dont know how to handle the application being launched by opening a file (which does not ope  due to the error).</p>