rendered paste body#include <cstdlib>
#include <cstring>
#include <windows.h>
#include <cstdio>
int main(int argc, char ** argv)
{
if(argc < 2)
return -1;
char file[MAX_PATH];
char path[MAX_PATH];
strcpy(file, argv[1]);
int iLength = strlen(file);
file[iLength - 6] = 0;
iLength = iLength - 6;
int iSlash = 0;
int i=0;
for(i=(iLength-1);i>=0;i--)
{
if(file[i] == '\\') { iSlash = i; break; } //update the location of our slash
}
char szNewFile[MAX_PATH];
for(i=0;i<((iLength-1)-iSlash);i++)
{
szNewFile[i] = file[i+iSlash+1];
}
szNewFile[i]=0; // Add null terminator.
for(i=0;i<iSlash;i++)
{
path[i] = file[i];
}
path[i]=0; // Add null terminator.
char command[512];
char command2[512];
char command3[1024];
sprintf(command, "cd \"%s\"", path);
sprintf(command2, "java %s", szNewFile);
sprintf(command3, "%s && %s", command, command2);
printf("Launching Java...\n\n");
system(command3);
system("pause");
}