Education
The situation in Australia at least, is that most educational institutions run Mac OS X rather than Windows, so a Windows style .exe would not run on those machines. E.G. my brother works in tertiary education, where they push OS X pretty hard. My cousin was recently complaining to me that her son's school required them to pay for a Mac based machine for the students. I explained to her that was mostly because Apple puts a great deal of thought into making their OS and applications so easy to use that the student is able spend more time doing stuff, than trying to figure out how to do stuff (I run Windows because it works out cheaper for me).
What they need
So if your teacher wants to see code, they will need a .java
file. If they are happy 'looking at a finished executable' they will probably require either an OS X based DMG or can get by with a Java based Jar.
Distribution
In days gone by, people would distribute applications on a floppy disk or CD, but times change and the advantage has now swung distinctly towards distributing via the internet or a network. There are now more machines that are 'internet ready' than have floppy or CD drives (mostly because of things like Netbook computers).
After initial distribution, there is also 'updates and bug fixes', and again the network trumps the disk.
Java has long had Java Web Start to do internet based distribution and update. JWS of course works on Windows, OS X & *nix - all the platforms for which a Java Runtime is supplied.
Availability of the plug-in
Of course, a Java app. requires the Java plug-in, so to account for that, Sun developed the Deployment Toolkit Script. It is a small script which we put in the web (intranet) page from which the app. is distributed.
The script checks for a suitable minimum version of the plug-in before offering the download button. If the user does not have it, they are guided through the process of downloading and installing it.
Security
As time goes by, OS makers are also cracking down more and more on security. On Windows, there is User Access Control. Sun had long been aware of the dangers, and sought to protect the reputation of Java by forcing Java applets to work within a security sandbox, and if the applet needed to relax the security restrictions to do things like printing or accessing the local file system, the code needed to be digitally signed by the developer, and trusted by the end user when prompted. Sun automatically carried that security over to apps. launched using JWS.
After recent security bugs were uncovered and fixed by Oracle, they decided that even sandboxed code need to be digitally signed, and it won't be long before code needs to be signed by a valid certificate issued by a Certification Authority. These organizations go to efforts to identify the people or institutions to whom they issue certificates, so the prospects for getting 'anonymous code' onto a machine are severely curtailed.
For a developer, it can be a hassle to gain a certificate, and digitally sign code, which might make an .exe seem attractive, but with the Microsoft based User Access Control, it is getting to the stage where most .exe files are also digitally signed.
Conclusion
Stick with the pure Java based route for apps. developed using the Java language. The only real advantage of making a .exe
is that an executable is slightly better attuned to the 'look and feel' of Windows. But if you need the 'true Windows' look and feel, it would be better to use a Windows based language (i.e. not Java) to develop it. It would also be easier for two reasons:
- Java sticks to a set of core functionality that it can support on all OS', so we sometimes need to include native code if we want to go beyond that. E.G. There are no Java based screensavers, and no Java based OS tools.
- It would be slightly faster to develop the GUI using a Windows based language and IDE, since the programmer could use Drag and Drop to make it. To make a robust cross-platform GUI the Java developer needs to understand and use Java layouts, which can be a steep learning curve, and are not very conducive to being built be Drag and Drop.