Results 1 to 18 of 18
Thread: Console Problem
- 02-27-2012, 10:52 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Console Problem
Hello,
Since I'm starting to get bored with the Internet languages (HTML, PHP etc.) i started to learn Java.
To do so i'm using a Dutch book ("En dan is er Java") which is going pretty well up till now.
But i just ran into a problem.
The book started with using JFrame, and i had no problems with using it.
But at this point it switches to not using any user interface, the console screen (black thingy).
He writes on it with:
System.out.println("Random text");
According to the book this should give the black command/console screen, but on my computer it doesn't.
I use NetBeans, and it does show the text (Random text) in the output on the bottom of the screen, but i don't get a black screen.
Does anyone know why i don't get the black screen, or is there another way to get this screen?
Gr
- 02-28-2012, 01:25 AM #2
Re: Console Problem
You won't get a command prompt when running the code from your IDE.
Open a command prompt and run your Java class from there.is there another way to get this screen?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-28-2012, 01:47 AM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Re: Console Problem
There are step by step instructions for this in Oracle's Tutorial - it is probably a good resource to accompany the book you are reading.
- 02-28-2012, 10:31 AM #4
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Re: Console Problem
So it doesn't have anything to do with me doing something wrong?
It just that the writer of the book doesn't use an IDE but uses notepad (for example)?
Thanks, i tried to do so, but couldn't really get the path right.
But if it isn't a major problem i'm just not going to run in in the command screen.
- 02-28-2012, 11:08 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
Being able to run Java code at a command prompt is quite an important step, since it ensures you understand the concept of classpaths in Java.
Misunderstanding classpaths is the root of many of the basic bugs we see here, largely because people have learnt using IDEs which hide that side of things from the user.Please do not ask for code as refusal often offends.
- 02-28-2012, 11:50 AM #6
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Re: Console Problem
Well, i tried and got the right path.
But when i try to run an java file he doesn't know what to do with it.
- 02-28-2012, 12:01 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
You can't run a java file.
You have to compile it first.Please do not ask for code as refusal often offends.
- 02-28-2012, 12:15 PM #8
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Re: Console Problem
Okay, i'm trying to do so right now.
But i got the following:
C:\USERS\NAME dir
This shows a list with everything in it, one of these things is the directory Documents.
But somehow i can't open Documents, when i try: C:\USERS\NAME\DOCUMENTS dir it says it can't find it or something
- 02-28-2012, 12:37 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
cd is the change directory command.
so 'cd documents'.
ETA: Indeed this is all in the link provided above by pbrockway2.
It leads you by the hand (at least on an XP box).Please do not ask for code as refusal often offends.
- 02-28-2012, 12:45 PM #10
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
- 02-28-2012, 01:37 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
Just do 'cd documents', since you're already in the directory containing the 'Documents' directory.
Please do not ask for code as refusal often offends.
- 02-28-2012, 01:39 PM #12
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Re: Console Problem
I tried, but it gives the same error (Invalid directory)
- 02-28-2012, 02:05 PM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
Then I have no idea what's wrong with your system.
Please do not ask for code as refusal often offends.
- 02-28-2012, 08:42 PM #14
Member
- Join Date
- Feb 2012
- Posts
- 7
- Rep Power
- 0
Re: Console Problem
Well, then im just going to skip this part.
My question has been answered, so i think the topic is then pretty much done
- 02-28-2012, 08:59 PM #15
Re: Console Problem
You're opening a command prompt via Command.com. That probably doesn't recognize Windows' long names, so Documents would be DOCUME~1 (or possibly ~2 / ~3 etc.
Try opening the command prompt via cmd.exe, that probably recognizes long names.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-29-2012, 09:31 AM #16
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Console Problem
They're on Windows 7, where it's just 'Documents'.
Microsoft shifted everything around.
And it works with both command.com and command.exe (just tried).Please do not ask for code as refusal often offends.
- 02-29-2012, 11:45 AM #17
Re: Console Problem
Oh. They seem to have 'upgraded' Command.com for Win7.it works with both command.com and command.exe (just tried).
btw you did mean cmd.exe, didn't you?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-29-2012, 11:54 AM #18
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
Help with Console
By thiagohe in forum Advanced JavaReplies: 7Last Post: 08-01-2011, 01:30 PM -
problem with console.readLine()
By thatguy in forum New To JavaReplies: 1Last Post: 12-14-2008, 07:40 PM -
Java console
By johnjw in forum New To JavaReplies: 5Last Post: 11-28-2008, 12:45 PM -
Console Progress Bar
By new_2_java in forum New To JavaReplies: 1Last Post: 02-16-2008, 02:18 AM -
Console doesn't appear!
By PeteMarsh in forum New To JavaReplies: 2Last Post: 12-17-2007, 05:41 PM


LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks