I'm using a simple C++ program to run an executable .jar file in Windows 7 64 bit. I expected this to execute 64 bit java, but it doesn't, it executes the 32 bit version.
const char* javaw_path = "javaw.exe";
const std::string memory = "-Xmx" + user_configured_memory();
const char* jar = "-jar";
const char* jar_file = "\"HelloWorld.jar\"";
const std::string cli_args = get_cli_args(argc, argv);
const char* args[] = {javaw_path, memory.c_str(),
jar, jar_file, cli_args.c_str(), static_cast<char*>(NULL)};
const int ret = execvp(javaw_path, args);
We can have combinations of OS, JDK and Eclipse bit--ness, for instance a 64-bit JDK with a 32-bit Eclipse on a 64-bit OS, or 32-bit OS, 32-bit JDK, 32-bit Eclipse, 64-bit OS, 32-bit JDK, 32-bit Eclipse, or 64-bit OS, 64-bit JDK, 64-bit Eclipse. As someone mentioned above, if your programming in C++ on 32-bit, cannot be compiled, it has to be done on 64-bit and of course another 64-bit app to run the exe.
"If your C++ program is 32-bit, you can't do it. You must compile the C++ app as 64-bit and then you can call another 64-bit app from the executable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.