Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why cant i start my program in the console?

 
kelvin cheung
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
run, cmd and type :

java myprogram

i am on the right directory that my class file is.
 
Steve McCann
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class name is case sensitive - even in a Windows environment. Does your class start with a capital letter?
[ September 22, 2005: Message edited by: Steve McCann ]
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of error message do you get? (Word af advice: Don't just say "it doesn't work" or "it doesn't start", say specifically what you're doing, what you expect to happen, and what actually happens, including all error messages.)

Is the current directory part of the classpath? Maybe you need to type "java -classpath . myprogram"
 
Phil Dixon
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kelvin,

Have you compiled your program?

javac Myprogram.java

Oops. Just noticed you put 'class file' in your post.
The excitement of my first reply to a post got the better of me!
[ September 22, 2005: Message edited by: Phil Dixon ]
 
kelvin cheung
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get this message :

'java' is not recognized as an internal or external command,
operable program or batch file.
 
Aly Gilani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kelvin cheung:
i get this message :

'java' is not recognized as an internal or external command,
operable program or batch file.


Hi Kelvin,

I think your PATH variable is not set properly.



make sure you have C:\<JDK>\bin directory in the path.

HTH,

Aly
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you work through this, see if THIS helps. I'm looking for feedback on how to make it better, so let me know if it doesn't!
 
kelvin cheung
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yeah.
i did not know that I needed to set the path.
thank you all!

by the way,
Stan James: you got a very helpful page!
it did help me, seriously! thanks
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stan James:
As you work through this, see if THIS helps. I'm looking for feedback on how to make it better, so let me know if it doesn't!


That's a great reference. You should add a link to it from the JavaRanch FAQ.

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic