December 20th, 2012, 07:23 PM
Opening files with a .jar (in Windows)
Hello, I wish to ask a simple question which is not exactly about programming. I have a small java application that works with text files in a way similar to the notepad. I want files with a certain extension (e.g ".tex") to be opened on double-click with such program, so the method I used was going to the corresponding registry key:
classes_root > tex_auto_file > shell > open > command
And typing the following as the default value:
java -jar "E:\Stuff\Program\dist\Program.jar" %1
That does work, but with two problems:
1) It opens a command line window every time the program is called, which stays open until the program is closed. Ugly.
2) When the program is called in this way, for some reason it fails to interpret the relative paths inside the code (e.g it looks for "images\icon.png" in "E:\images\icon.png" instead of the relative path of the resource). Almost drove me mad, thinking there was a problem with the code itself.
Are there better alternatives to do this? If not, how may I solve this problems?
Thanks in advance.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!