This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
From what I know, .com files are rarely used any more except for specific system tasks. .exe files are much more common for several technical reasons, however this probably isn't the place to go into such a discussion.
There are some other tricks to make a single executable that will run your Java program. Although, for a single file with a single class, it probably isn't worth it. The trick I have begun to use lately is to create a JAR file (using the jar utility) that contains all the .class files that I compile from my source code. You need to make a manifest file with the "Main-Class" attribute set to the class that should be run from this jar file.
Once the jar is created, you can run it by typing
In Windows, you can also execute the jar file by double-clicking it in Windows Explorer.
There are also compilers available that compile your Java program into an executable, but I am not familiar with them. The main draw back is that the compiled program looses Java's cross-platform capabilities. On the other hand, the jar file I described above can usually run as-is on any machine with a JVM installed.
p.s. You may also want to use the Search tool (see the link at the top of the page) to find previous messages discussing this topic. You can start with "stand alone executable" and see what you can find.
For creating an exe, I recommend trying a quick search on this and the intermediate forums for "java exe".
If you go the exe route, please report back and let us know how things went. Of course, if you run into a problem, don't hesitate to post a question about it. I'd recommend the intermediate forum for such a conversation. [ September 19, 2004: Message edited by: Dirk Schreckmann ]