This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Why does Java take a long protocol of having the programmer to compile in text editor like Notepad before getting to DOS to compile, and run. Besides, most source files saved in NOTEPAD do not become .java until I tried DOS Edit. Is there a special procedure which can make sourcefiles hava .java. NoteL I saved my source files as .java in Notepad
Make sure, when you're saving a file in Notepad, that the "File type" dropdown box is set to "All Files." If it's set to ".txt" files, I believe your file will be named "YourFile.java.txt". If you set that drop down to "All Files," I believe you can avoid this problem.
Of course, there are other editors out there that are much nicer than the vanilla notepad that comes with Windows. I like Ultra-Edit, myself, but everyone has a preference.
Originally posted by Jay Jay King: Why does Java take a long protocol of having the programmer to compile in text editor like Notepad before getting to DOS to compile, and run. Besides, most source files saved in NOTEPAD do not become .java until I tried DOS Edit. Is there a special procedure which can make sourcefiles hava .java. NoteL I saved my source files as .java in Notepad
Others have given very good advice. My post is to address your misunderstanding that I've boldfaced in the above quote. You do not, generally, compile in the text editor and you certainly cannot do that in Notepad (although some editors do provide you with such a capability). You merely write the program in a text editor.
To expand on Sadanand's point... How else are you going to create the .java file?
To back up a little, there are three main steps in creating and running a java program.
1) write the source file 2) compile the source file into a .class file 3) execute the class file
These are gross simplifications, but the basics are correct. So you ask "why write the file in a text editor?"
I'd answer that with "how ELSE are you going to create the source file?" And save it? and modify it? Java doesn't care HOW this file is created - you can use ANY editing tool you want. if you want to write an assembly program that directly connects to the hard disk and writes the file byte by byte - go for it. as long as it follows certain rules (named .java, the public class name matches the file name, etc) you can create this file any way you want.
once the file is created, you then proceed to steps 2 and 3. There are some tools that let you do all 3 steps within the tool - they integrate the text editor, compiler and run-time environment (and are called Integrated Development Environments, or IDEs). They may do fancy things like paren-mathcing, finding syntax errors, etc. But those are all just bells and whistles.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Thanks you all for sending in lovely replys. I tried the " " method/.all files method and it worked. I might not be replying with my original ID as JAY JAY King, this is becos I lost my password. Thanks