I want to make a "launcher" for my jar program, basically my exe file doesn't do anything by its own, its simply for launching my jar program.
My jar program can open a file, and as far as I know (pay atention to this because maybe here is the problem) the OS opens a file by passing a command line argument to the program that contains the path to the file, right?
If I execute my program using the play button in Visual Studio it works fine, I put the arguments in Properties->Debug->Command line arguments, it launches my jar and opens my file
If I execute my program from CMD, passing the argument through cmd as well, it works fine and once again it opens mi file
But if I do right click on the file that I want to open, then "open with"... I get the System.ComponentModel.Win32Exception
I thought, maybe the program needs to be installed, so I created a innoSetup installer, but if I do right click->open with... I get Win32Exception
What am I doing wrong?
My code :
class Program
{
static void Main(string[] args)
{
var programa = new System.Diagnostics.Process();
programa.StartInfo.UseShellExecute = true;
programa.StartInfo.FileName = "Personas.jar";
String archivo ;
try
{
archivo = args[0];
}catch(System.IndexOutOfRangeException e)
{
archivo = null;
}
if(archivo != null)
{
programa.StartInfo.Arguments = archivo;
}
try
{
programa.Start();
}catch(Exception err)
{
}
}
}
I won't put the Java code because the problem is clearly in C#