Question:
C++ File Pathing/Executable Help!?
2012-06-05 16:22:44 UTC
Hi everyone

I need help with launching Java.exe with -Xmx and -Xms parameters, and launching a .Jar file
I have the Batch code for this.. could someone "translate" this into C++?

Batch code

@"%Programfiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms768M -jar "%Homepath%\Desktop\minecraft.jar"

Here's what I have so far..

void main() {
ShellExecute( NULL, NULL, "%Programfiles%\Java\jre7\bin\java.exe", NULL, NULL, SW_SHOW );
}

Is this correct? And can someone please add the -Xmx, -Xms parameters, and add the .Jar executable?
Three answers:
2012-06-05 16:29:44 UTC
Use the system command to execute stuff from c++ programs.



http://www.cplusplus.com/reference/clibrary/cstdlib/system/



Make the parameter



@"%Programfiles%\Java\jre7\bin\java.ex… -Xmx1024M -Xms768M -jar "%Homepath%\Desktop\minecraft.jar"



and it should work.



Join StackOverflow.com for good answers to programming questions. You actually get code formatting, there.
Michael
2012-06-05 16:30:57 UTC
This isn't really a C++ question - it is a "whatever the hell operating system you are using" question.



Depending on the definition of ShellExecute() you may need to expand the %Programfiles% token to whatever it stands for - or perhaps ShellExecute will do that for you - read the documentation to find out.



Be aware that if you need to use the \ character in a C or C++ string you need to type its as \\ because \ is used to introduce certain escape sequences into strings and thus "\\" represents a single backslash character ...
?
2016-10-04 04:49:25 UTC
No. I artwork as an emergency medical technition. i'm a mandated reporter, meaning if I have any reason to suspect baby abuse, then i ought to record it. If i do not record it, then i'm committing against the law. As an EMT (a minimum of, contained in the county that I stay in) I have the skill to take a baby into protecting custody if I have reliable adequate suspicions of kid abuse (note: that is provided that i'm on a call and the youngster has cigarette burns or different glaring inflicted wounds, this does no longer artwork a lot if i'm off duty). between the flaws that we were informed contained in the component to our coaching about baby Abuse is that any suspicion, although miniscule, could be stated to CPS. A pretend record, properly, yeah, it really is honestly unlawful, yet any suspicion with any grounds in the back of it (again, regardless of ways minor) will given a glance over. that is mandatory to take all circumstances heavily. a procedures too many children wade through and die (convinced, die, we had a touch woman die from baby abuse in simple terms those days in my section) from baby abuse no longer to take each case heavily.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...