Jump to content

Creating a java program that acts like a normal windows executable?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
rolls

rolls

    Newbie

  • Members
  • PipPip
  • 10 posts
I know you can compile java programs into a single .jar file that you can execute but I have a problem and I want to know if it can be solved.

Now I have a custom file format that has the extension .dta the files contain some data to create a graph. Now I want to be able to double click these files and have them open in my java program. Also if the program is already open I want any further files that are opened (not via the file > open functionality) to open in this same instance of the application.

How can I do this and what would be the best way. Should I use a separate launcher application written in say C# that calls the java -jar application.jar filename? Or is there an easier way to do this.

Thanks in advance. :)

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
a .bat file should do as well I guess, on windows, then just register the extension in windows registry as usual.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
rolls

rolls

    Newbie

  • Members
  • PipPip
  • 10 posts
A batch file looks so ugly and unprofessional though. Also how would it allow further files to be opened in the same window?

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
jEdit is an example of registering the entire command as the "associated executable". You associate "java -jar [myfile].jar %1" and have your jar able to read the command-line parameters.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
rolls

rolls

    Newbie

  • Members
  • PipPip
  • 10 posts
Hmm I guess I could do it that way, I don't like how the black command window pops up though, if I could stop that from happening I would accept that as a solution. Also how could I get new files to open in the existing java window and not load a separate instance of it?