[Comp.Sci.Dept, Utrecht] Note from archiver<at>cs.uu.nl: This page is part of a big collection of Usenet postings, archived here for your convenience. For matters concerning the content of this page, please contact its author(s); use the source, if all else fails. For matters concerning the archive as a whole, please refer to the archive description or contact the archiver.

Subject: Re: Java Programmers FAQ

This article was archived around: 21 May 1999 13:52:39 -0700

All FAQs in Directory: computer-lang/java/programmers
All FAQs posted in: comp.lang.java.programmer, comp.lang.java.help, comp.lang.java.gui
Source: Usenet Version


Here are the diffs for the latest Java FAQ. Lines: 292 NNTP-Posting-Host: shell15.ba.best.com X-Trace: nntp1.ba.best.com 927319969 221 pvdl@206.184.139.147 Xref: cs.uu.nl comp.lang.java.programmer:251425 comp.lang.java.help:67063 comp.lang.java.gui:41500 comp.answers:36579 news.answers:158939
19c19 - \ | Last modified May 11, 1999 Peter van der Linden | / --- + \ | Last modified May 19, 1999 Peter van der Linden | / 30c30 - ------------------------------------------------------------------------ --- + ------------------------------------------------------------------------ 85,86d84 - Sample chapters (from the previous editions -- must fix that) are on - Sun Microsystems' webpage at http://www.sun.com/. 154c152,154 - 2. Download a free Java compiler from http://java.sun.com --- + 2. Download a free Java compiler from http://java.sun.com Service + packs for Solaris (if any are needed) can be found at: + http://www.sun.com/solaris/jdk/download.1.2.1_02/en/sparc/1.2.1_02_sparc_jdk_patches.tar 833a834,841 + In May 1999, Dejanews changed their name to Deja.com, and their web + design to a truly horrible garish interface, covered with ads and + harder to search. Consider using these search sites instead: + http://www.exit109.com/~jeremy/news/deja.html + http://www.dogpile.com + http://www.google.com + http://www.hotbot.com + http://www.mamma.com 1110a1119 + and at http://www.gamesdomain.co.uk/GamesArena 1204a1214 + comp.lang.java.advocacy (argue all day with anonymous shills) 1205a1216 + alt.comp.lang.java-games 1685,1686c1696 - [*] In JDK 1.1.x you use the commandline option "-Dnojit". - In JDK 1.2/2 you use "-Djava.compiler=none" --- + [*] The command that works in both JDK 1.1.6 on, and JDK 1.2/2 is + java -Djava.compiler=NONE ... 1691,1692c1700,1708 - 16. (Sect. 4) How can I store the errors from the javac compiler in a DOS - file? --- + + One reason for turning off the JIT is to get more + information about any exception that is thrown in your code. + But HotSpot is able to produce line numbers in stack traces + even for JIT'd code. HotSpot rocks. + + 16. (Sect. 4) + How can I store the errors from the javac compiler in a DOS file? + 1705,1711d1718 - Alternatively, you can get a scollbar to appear on a DOS window by - changing the properties with the "Layout" tab. Change the Screen Buffer - Size Height: to some multiple > 1 of the Window Size Height. E.g. use a - buffer height of 100 and screen height of 25 (the default). This will - give you three buffers of scroll "history." - The DOS limitation is improved in NT, where you can write - javac myfile.java 2> errors.dat 1713c1720,1721 - 17. (Sect. 4) How can I pretty-print Java source? --- + In JDK 1.2, you can use: + javac -Xstdout 1715,1720c1723,1724 - [*] For tools that reformat code, try: - o http://www.parallax.co.uk/~rolf/download/jpp.pl - o http://www.bigfoot.com/~davidsont/jstyle - o http://www.mmsindia.com/JPretty.html - o http://www.almide.demon.co.uk/source_code/java/JavaCC/Pretty/Pretty.html - o http://www.geocities.com/~starkville --- + You typically use this when a compilation produces a lot of error messages, + and they scroll off the DOS window before you can read them. 1722,1723d1725 - For tools that print code neatly, try: - o http://www.eng.auburn.edu/department/cse/research/grasp/ 1725,1740c1727,1732 - Some Unix utilities work adequately: - o cb (very few style choices though) - o alias printjava 'vgrind -lC++ -t -w \!* | lp' works pretty well - too. - Perhaps the best tools are the GNU utilities. Use enscript to generate - postscript files with Java-specific formatting. Then use - GhostScript/GhostView to preview and print the files to a - non-PostScript printer, if necessary. The scripts can be found at: - o GNU Enscript - pretty printer and PostScript formatter - o Ghostscript, Ghostview, and GSView for Unix - o gsv25w32.zip - GSView for NT (requires the following Ghostscript - files) - o gs510ini.zip - Ghostscript configuration, initialization, and - example files - o gs510w32.zip - Ghostscript core binaries for Windows NT - o gs510fn1.zip - Ghostscript standard fonts --- + Alternatively, + you can get a scollbar to appear on a DOS window by changing the properties + with the "Layout" tab. Change the Screen Buffer Size Height: to some + multiple > 1 of the Window Size Height. E.g. use a buffer height of 100 and + screen height of 25 (the default). This will give you three buffers of + scroll "history." 1741a1734,1826 + + The DOS limitation is improved in NT, where you can write + + + javac myfile.java 2> errors.dat + + + 17. (Sect. 4) + How can I pretty-print Java source? + [*] + For tools that reformat code, try: + + + + + + o + + http://www.parallax.co.uk/~rolf/download/jpp.pl + + o + + http://www.bigfoot.com/~davidsont/jstyle + + o + + http://www.mmsindia.com/JPretty.html + + o + + http://www.almide.demon.co.uk/source_code/java/JavaCC/Pretty/Pretty.html + + o + + http://www.geocities.com/~starkville + + + + + For tools that print code neatly, try: + + + + + + o + + http://www.eng.auburn.edu/department/cse/research/grasp/ + + + Some Unix utilities work adequately: + + + + o + cb (very few style choices though) + + o + alias printjava 'vgrind -lC++ -t -w \!* | lp' works pretty well too. + + + Perhaps the best tools are the GNU utilities. Use enscript to + generate postscript files with Java-specific formatting. Then use + GhostScript/GhostView to preview and print the files to a + non-PostScript printer, if necessary. The scripts can be found at: + + + + o + GNU Enscript - pretty + printer and PostScript formatter + + o + Ghostscript, Ghostview, and + GSView for Unix + + o gsv25w32.zip + - GSView for NT (requires the following Ghostscript files) + + o + + gs510ini.zip - Ghostscript configuration, initialization, and + example files + + o + + gs510w32.zip - Ghostscript core binaries for Windows NT + + o + + gs510fn1.zip - Ghostscript standard fonts + + 1746,1748d1830 - Most of the "questions" in this section are diagnostic messages from - the compiler. Each answer explains what the message means, and how to - avoid it. 1750,1751c1832,1833 - 1. (Sect. 5) Why did I get an OutOfMemory error when porting working code - from JDK 1.0.2 to 1.1? --- + Most of the "questions" in this section are diagnostic messages from the + compiler. Each answer explains what the message means, and how to avoid it. 1753,1754c1835,1840 - [*] The preset memory limit has changed. It went down to 16MB so as not - to penalize low memory machines. You can adjust it with --- + 1. (Sect. 5) + Why did I get an OutOfMemory error when porting working code from + JDK 1.0.2 to 1.1? + [*] + The preset memory limit has changed. It went down to 16MB so as not to + penalize low memory machines. You can adjust it with 4104,4106d4189 - Control-C is not a Java concept, and there is no way to do this in pure - Java. You can write the signal handler in C however, and impose the - handler by calling the C routine through the Java Native Interface. 4107a4191,4203 + Control-C is not a Java concept, and there is no way to do this + portably. + On Unix you can write the signal handler in C, and impose the handler + by calling the C routine through the Java Native Interface. + On Win32 in a GUI a KeyPressedListener will see a control-C as + java.awt.event.KeyEvent[KEY_PRESSED,keyCode=67,modifiers=Ctrl] + On Win32 in a command line app you can't read a control-C in Java + because it is sent to the process as a signal (as with Unix). + Instead of interposing a signal handler thru JNI, you could launch java + from perl or a shell script which is capable of doing this. + Alternatively, use javaw to launch the JVM so that it has no keyboard + which can ctrl-C it. + 5524a5621,5622 + On Windows, the icon must be 16-by-16 pixels. + 7684a7783 + http://www.aba.net.au/solutions/crypto/jce.html 8298a8398,8414 + However, you cannot read output from some DOS commands on Windows + 95/98. This is bug 4211683 at Sun, but it is actually a Microsoft + bug/poor design. Windows programs that explicitly use a handle to the + console ("CON" or "CON:") instead of stdin and stdout cannot be used as + subprocesses to Java. The Win95 FTP program is an example of such a + program. Windows provides no convenient way for Java to redirect the + input and output of such processes from the console to input and output + pipes. The only workaround is to use a different implementation of the + program that does not use the console directly. + + Microsoft documents a difference in DOS Console stream handling between + 95 and NT: see + http://support.microsoft.com/support/kb/articles/q150/9/56.asp + + So capturing output from GNU ls on Win95 works, but the output from + "command.com /c dir" is not captured. + 8515,8516c8631,8632 - FileDialog will need to be rewritten to support FilenameFiltering, and - JDK 1.2 is the earliest feasible point for changing the API. --- + JFC has a JFileChooser class that is a better bet for you to use for + file dialogs. It works fine. 8518,8520d8633 - JFC has a JFileChooser class that is probably a better bet for you to - use for file dialogs. - 8563c8676 - confusing and misleading endIndex. Beware of the substring trap. --- + confusing and misleading endIndex. Beware the substring trap. 9036a9150,9165 + 24. (Sect. 19) Why do I get the error message "Wrong number of arguments in + constructor" + + [*] Almost certainly, you have written your constructor with a return + type or void or something. I.e. you have written: + + public MyClass Myclass() { ...} + + instead of: + + public Myclass() { ...} + + Giving a constructor a return type makes it into a regular method that + happens to have the same name as the class. The language should ideally + outlaw this, but it doesn't. + 9456c9585 - Bill McHardy --- + Bill McHardy, Phillip Lord, Jon K. Hellan