Hi.
Java is a cross-platform interpreted language and therefore won't compile to
a standard EXE without using some third-party tools. Even with these tools
you need the Java Runtime Environment present to be able to launch your
application. The simplest way would be to simply make a shortcut to your JAR
archive. Most Window's will launch JAR files if you place the correct
manifest in the file. The Java Doc's explain how to make JAR files.
If you really want to make an EXE file with which to launch your application
(and I don't recommend it) you could create a program that calls the Java VM
and passes as a parameter the JAR archive or the main java file for your
program. Again, I won't recommend this, as a simple shortcut would be
sufficient. To launch an external file in C, a quick way is to call the
Win32 API like this:
ShellExecute(NULL, "open","c:\\myfile.jar", NULL, NULL, SW_SHOWNORMAL);
Of course, you could launch any file associated with an application in
Windows using this call, I often replace the "c:\\myfile.jar" part with the
names of documents or spreadsheets I want to open in an application program.
This is an outdated API call if I remember correctly, but it is still
supported on most Win32 platforms and easy to call.
Good luck
Ewald Horn
Proprietor/Eienaar : Horn Labs
Cell/Sel : 083 519 1615
Website : http://www.hornlabs.co.za
Email/E-pos : in...@ho...
|