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.
This is more of a question on programming concept than anything.
After 7 or 8 months of experience in Java, I'm still quite comfortable using the console window for IO for my program (although I'm not using commandline). I just recently saw a fellow student create a manifest file with an applet that allowed the .jar file to be clicked on to run the program. This I found rather useful because it allows portability without having to always launch from the IDE I'm using (CodeWarrior). I noticed that there is no console window when using the manifest file (programs I make manifests with that have no GUI do not come up at all, as if they're dead). This is fine as I intend (for, at least, programs I'd like to show off) to use a fancy GUI, but the observation led me to an interesting question.
Is the console window just there as a debugging tool? I mean, is it not intended for larger projects and just used for development to roughly see where the program is going and such? Or is this just something to do with my IDE and can java programs be run as stand-alone from the console?
The "console" window is left over from the days when every program was executed by typing its name on screen; it is a way to instruct the computer to do something directly. It was used a lot on *nix systems and DOS, but much less on Windows. It is also called a terminal window, or a shell, or command prompt, on different OSs. So it is regarded as the standard access to your OS, but only in the last versions of Java (J6) was there an explicit Console class. Any Java program can be run as a standalone application from a console terminal shell or command prompt. I am a bit surprised you were introduced to an IDE before a console!
I have to agree with you, Campbell. Everybody should have to write Hello World in a text editor and compile and run it from the command line. I wouldn't expect IDEs to be introduced until after the basics of the language are understood.
(insert crotchety comments about coding uphill in the snow in both directions here.)
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Joined: Nov 02, 2007
How does the console winddow operate differently than say a GUI?
I mean is it something that took a lot of code to make or is it something that's just kind of "there"? if that makes sense?
I don't know why I was given an IDE first though. I did learn enough command line to run a program (sort of), when seeing how to make a .exe file out of Java using a third-party program and all that, so its not something that'd be too hard to learn and stuff.
Joined: Oct 13, 2005
Originally posted by Christopher Young: How does the console window operate differently than say a GUI?
It is like chalk and cheese. The console is not part of Java, but part of the OS; if you are on Linux you will almost certainly have a terminal launching icon on your panels. If you are using command line you are probably on Windows and the window you write the command line instructions on represents the console.
The JVM in fact doesn't know about the console at all. All it knows about are streams that are provided by the operating system. It's the responsibility of the OS to connect those streams to a console window - or to something else, as most operating systems allow those streams to be redirected. And some operating systems might not even support them at all.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus