i wrote this trivial piece of C code.
compile this program and rename it to the same name as your class file.
so, if you have Foo.class
then copy this program as Foo.exe in the same directory as Foo.class
you will type:
Foo
and the class file will be run. Thus you can use this as a generic cover
function.
it is useful but it could be improved. (and it's GPL so give it away)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 4096
char command[MAX];
void main(int argc, char *argv[])
{ char *lastslash = NULL;
int i = 0;
int cmdlen;
strcpy(command,"java ");
cmdlen = strlen(command)-1;
lastslash = strrchr(argv[0],'\\');
if (lastslash == NULL)
strcat(command,argv[0]);
else
{ for(i=1; *(lastslash+i) != '\0'; i++)
command[cmdlen+i]=*(lastslash+i);
command[cmdlen+i]='\0';
}
for (i=1; i != argc; i++)
{ strcat(command," ");
strcat(command,argv[i]);
}
system(command);
}
> Anupama Jayathilake wrote:
>
> I got a problem.Please advice me.
> I want to compile my java class to a binary so that i can run it
> from commant prompt without giving "java myprogram"
> How can i compile java class.
> Please help me
> Anupama
>
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]