Allright, this is the deal, im trying to use Install Sheild to install a program I wrote in java. But I cannot make shortcuts on the desktop and/or START menu linking to the .jar file, it has to be a .exe file, so I need to make a simple .exe file so I can have shortcuts. this is my simple program so far:

#include "stdafx.h"

using namespace System;
using namespace System::Diagnostics;

int main(array<System::String ^> ^args)
{
    Process^ minProsses = gcnew Process;
    ProcessStartInfo^ minProssesStartInfo = gcnew ProcessStartInfo("\\test.jar");
    minProsses->StartInfo = minProssesStartInfo;
    minProsses->Start();
    return 0;
}

but it doesn't seem to find the .jar file, might be that the address is wrong and it doesn't accept \\ to be the folder itself is in.

So there is one thing, it doesn't know what folder it is in, since people can install it where they want, so I cannot really set the shortcut to be "C:\\Program Files\\MyProg\\test.jar". It has to be like this; "CurrentDirectory" + "\\test.jar" or something.

Really hope someone here can help me out, since I've already tried 2 other forums.
And yes, I'm not so good with C++, just a small course at school, but this should be easy, but I can't seem to find the answer.

thx for your help
LordSvae

Recommended Answers

All 3 Replies

> It has to be like this; "CurrentDirectory" + "\\test.jar" or something.
so just use a relative path "test.jar". and put the .exe and the .jar in the same folder.

ProcessStartInfo^ minProssesStartInfo = 
                                   gcnew ProcessStartInfo( "test.jar" ) ;

ok listen, it works. Though not when you use Visual Studio to compile it, then it doesn't work. Dunno if it uses the .exe file after its compiled, but when I took the .exe file and put it in the folder with the .jar file, it worked. So there, its solved.

allthough, vista doesn't accept the .exe file, doesn't want to run it, gives me some kind of error message. But doesn't matter. XP is the OS for me anyways.

> it works. Though not when you use Visual Studio to compile it, then it doesn't work.
you really mean, when you run it from inside Visual Studio.
the reason is that in this case, the current directory of the process is the project directory, not the director(y/ies) where the executable file is located

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.