I'm a total nubie. I thought it would be useful to download the source for an applet and study the code. I picked a wonderful applet by Don Hatch:
http://www.plunk.org/~hatch/HyperbolicApplet/?size=513. The code in the jar file is all in .prejava files. My IDE (NetBeans) doesn't know what to do with these files. When I rename the extension of the main class source from .prejava to .java I get a lot of errors. Can anyone help me understand what .prejava files are and how to work with them?
Thanks.

Recommended Answers

All 7 Replies

The .prejava files are actually his .java files. You'll have to rename each .prejava file to .java. Once that is done your ide shouldn't have any more errors.

hooknc,
I tried what you suggested: I changed the extension on all 15 .prejava files to .java (before, I had only changed the extension on the source for the main class). I got the same errors as before. I noticed that Don has a file called "javacpp" (without an extension). Within my IDE I could read that file, which says that javacpp "Runs the C preprocessor (cpp) on .prejava files to create .java files". I tried to run javacpp at the DOS prompt to create the .java files, without success (DOS said it couldn't find an executable by that name). Any suggestions?
Thanks.

hooknc,
A further note: I added the .exe extension to javacpp and ran "javacpp mainclass.prejava" at the DOS prompt (after setting all the .java extensions back to .prejava). This hung up the DOS cmd.exe with 100% of my CPU dedicated to ntvdm.exe. Any ideas?
Thanks.

He has built this applet using a linux machine and so all his scripts will only run on linux. So, trying to run the scripts on a windows machine most likely will not work.

Overall I'm not exactly sure what he is doing (I'm not very good with c or linux scripts). But, this is not how a majority of java developers do their development and is most likely not a good example to learn java or java applets.

If still want to try and fallow what he is doing... I would recommend decompiling his java files instead of reading the .prejava files. There are numerous free java decompilers if you do a search on google.

hooknc,
Thanks for the advice. I was attracted to Don Hatch's applet both because I am interested in the subject (hyperbolic tessellations), and because it seemed to be a very well designed program. Maybe I should concentrate on very simple things until I gain some experience with Java. I sent Don an email asking for his help; if he can't help me, maybe I'll try the decompiler approach. I greatly appreciate you taking the time to help me out. I think it would be nearly impossible for beginners to get started without the help of people like yourself.
Kind regards,
Steve

You can try DJ Java Decompiler: [snipped]

DJ Java Decompiler is Windows 95/98/Me/NT/2000/XP/2003/Vista decompiler and disassembler for Java that reconstructs the original source code from the compiled binary CLASS files (for example Java applets).

This thread is from 2006!

He has built this applet using a linux machine and so all his scripts will only run on linux. So, trying to run the scripts on a windows machine most likely will not work.

The whole point is java is platform independant. It is CORA. Compile to bytecode once, run (in the VM) anywhere

Overall I'm not exactly sure what he is doing (I'm not very good with c or linux scripts). But, this is not how a majority of java developers do their development and is most likely not a good example to learn java or java applets.

yeah it looks like crap

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.