I was wondering if there was any way to program from the command line prompt. I am running windows 7, and I can compile and run code using the javac and java commands with the JDK, but I was wondering if I could program from the command line as well, instead of using an IDE or even NoteBook. Thanks in advance.
What exactly do you mean by "programming from the command line"? As Java isn't a scripting language and therefore doesn't provide something like a scripting shell you should at least have some kind of editor. Maybe the old command line editor (don't know if it's still included in Windows 7) is enough for you then you can program from the command line. More or less. It may work but it's surely not very convenient without any tool support.
Joined: Aug 28, 2010
Thanks for the reply.
I know what you mean about tool support. It is a lot easier to write code with an editor. However, I have a buddy who is asking me to research the idea for him. I have always used netbeans to compile and run programs, personally.
I am simply researching the idea of writing code from the command prompt (yes, windows 7 still has it) and saving it in a .java file so that one can compile it with the javac command and run the .class file with the java command.
A more convenient approach would be to find a command line editor of your choice which can help you to automate at least the edit-compile-run-cycle a little bit to speed up development. On Linux for example Emacs or vi are well-known editors which at first seem to be simple command line editors but there are many ways to extend the core functionality which makes a little command line IDE of these editors. I guess they are ported to windows too (maybe via Cygwin) or probably there are other command line editors for Windows which allow similar features.
Andrew Monkhouse wrote:... even the "edit" command (assuming it still exists in Windows 7)) ...
In case you are unaware of that editor, it was introduced around DOS 4.0 (I think - I remember using it prior to Windows 3.1). From the command line, you enter "edit [filename]" (e.g. "edit Hello.java") and it opens the file in a simple editor:
Not a great editor, but it will get the job done. And is way better than millions of "echo" type statements.
author and jackaroo