| | |
open fil in same catalog as .exe file
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
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:
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
C++ Syntax (Toggle Plain Text)
#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
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> 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.
so just use a relative path "test.jar". and put the .exe and the .jar in the same folder.
C++ Syntax (Toggle Plain Text)
ProcessStartInfo^ minProssesStartInfo = gcnew ProcessStartInfo( "test.jar" ) ;
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
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.
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.
Last edited by lordsvae; Feb 17th, 2008 at 11:11 am.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> 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
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
Last edited by vijayan121; Feb 17th, 2008 at 11:20 am.
![]() |
Other Threads in the C++ Forum
- Previous Thread: converting iostream to fstream code...need help
- Next Thread: MultiDimension Array help
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference simple string strings studio system temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






