Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news2.arglkargh.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news.space.net!news.osn.de!diablo2.news.osn.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 06 Jan 2013 08:04:40 -0600 From: "Chris Uppal" Newsgroups: comp.lang.java.programmer References: <-8CdnaTS2P6a5HTNnZ2dnUVZ8vOdnZ2d@bt.com> Subject: Re: "Hello world!" without a public class? Date: Sun, 6 Jan 2013 14:02:31 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 Message-ID: Lines: 48 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-oMMps2fQmVWOmZPTUNv1FN2ZyAfTbgUA15g4tjoUlem+PRoffs9bzKQJWObNxzk5Yk49DxmB7yTldRY!fAmaINXhoN8S+bBiWohqHlwmEqsj88Dmif/fBvFknvP3UXPHrzqQY1m3a5I+wErGnKh2RUNVIP4= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3106 Xref: csiph.com comp.lang.java.programmer:21028 Stefan Ram wrote: > "Chris Uppal" writes: > > students if you made that very clear to them from the start (yes, there > > is a > > I have no idea what you would prefer instead, but I just > made up this: > > Rename »java.exe« (the JVM) to »new.exe« and modify the > interpretation of its command line arguments so that one can > write on the command line: > > new Main().start() Or maybe (simpler, but less Java-like): javaNew.exe class-name method-name [arguments...] Note that there's no need to mess with the JVM for these purposes, it only requires a special-purpose launcher program to replace java.exe. The source to java.exe is provided, it's a simple JNI program, and is explicitly open for you to copy/modify/reuse without special licencing arrangements (at least that used to be true, haven't checked whether Oracle have changed anything). But that might be overkill (however attractive). Maybe simpler just to tell students always to write their entry-point in the form: class Xxx { public static void main(String args...) { new Yyy().doSomething(); } } (note that the entry-point class always contains main() and nothing else) and to treat that pattern as "magic". Late in the course, after they've got a solid grounding in OO and (even later) you've talked about things like static methods (and why they are often a bad idea), you can explain what's going on with main(). With luck, by that point the students will be able to see that it's highly non-typical of Java code, and breaks several "rules", but (by then) you'll also be able to explain /why/ it's such a special case. (All just ideas, of course, I am /not/ an educator, let alone an educationalist) -- chris