Compiling your Java App to Native Code.

 Well, its quite unlike that you want to convert your Java App to Native Code, because of its Platform Independence. But  when an application is targetted to one particular platform probably we can convert to the native Code, that improves the speed of your app.

   Now the next Question would be .. How to Convert it? 

 Here is a code which converts to the Native Code…


//The #include directive treats
//text in the file specified by
//filename as if it appeared in the
//current file.


//The #define directive defines a macro.
#define MAIN_CLASS “MyFrame.jar”
int main()

 //malloc() allocates a block of size
 //bytes from the memory heap.
 char* cmdline = (char*)malloc(1024 );

 //sends formatted output to a string
 sprintf( cmdline, “javaw.exe -jar %s”, MAIN_CLASS );

 //system() invokes the
 //DOS command interpreter
 system( cmdline );

 //deallocate the memory
 free (cmdline);

 return 0;



  1. @Ashwin Anand :- Hey i havent worked much on Netbeans. well i dont think this is the only way to convert your app to exe for windows… its one of the simple ways..

    You can actually go for installshield.. or there are umpteen number of softwares to do so.. But the power of our legacy “C” is significant in my above post..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s