javac is not recognized as an internal or external command

First time JAVA user needs help

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 54461 Views - Last Post: 22 January 2010 - 06:17 AM Rate Topic: -----

#1 villalandron  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 153
  • Joined: 24-September 08

javac is not recognized as an internal or external command

Posted 24 January 2009 - 10:00 AM

Hello!

I just started a beginner's class for JAVA and the book doesn't explain much. My first assignment asks me to write my first JAVA program. I used notepad and saved it as MyFirstProgram.java. It then tells me to go to the operating system's command prompt and change my current directory or folder to the one that contains the JAVA program I just created. Then asks me to compile the program by typing javac MyFirstProgram.java. It tells me that javac is not recognized as an internal or external command, operable program or batch.

I have MyFirstProgram.java saved in my desktop and what appears on the command prompt is: C:\Users\Jay>javac MyFirstProgram.java

What am I doing wrong? any help for a noob will be appreciatted. Thank You!

Is This A Good Question/Topic? 0
  • +

Replies To: javac is not recognized as an internal or external command

#2 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 674
  • View blog
  • Posts: 4,349
  • Joined: 24-October 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 10:02 AM

do you have the the java virtual machine installed on your computer?
Was This Post Helpful? 0
  • +
  • -

#3 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 10:22 AM

If you installed the java compiler and such from sun you may have to modify the class path to recognize the commands without typing them out fully each time ie javac instead of c://programfiles/myjavalocal/javac.exe.
Was This Post Helpful? 0
  • +
  • -

#4 villalandron  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 153
  • Joined: 24-September 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 11:56 AM

View Postmostyfriedman, on 24 Jan, 2009 - 09:02 AM, said:

do you have the the java virtual machine installed on your computer?


Do I need to have the Java Virtual Machine or will it conflict with JDK?

View PostBigAnt, on 24 Jan, 2009 - 09:22 AM, said:

If you installed the java compiler and such from sun you may have to modify the class path to recognize the commands without typing them out fully each time ie javac instead of c://programfiles/myjavalocal/javac.exe.


I'm sorry but, I'm a very beginner. How do I modify the class path?
Was This Post Helpful? 0
  • +
  • -

#5 markhazlett9  Icon User is offline

  • Coding is a lifestyle
  • member icon

Reputation: 60
  • View blog
  • Posts: 1,666
  • Joined: 12-July 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 11:58 AM

View Postvillalandron, on 24 Jan, 2009 - 10:56 AM, said:

View Postmostyfriedman, on 24 Jan, 2009 - 09:02 AM, said:

do you have the the java virtual machine installed on your computer?


Do I need to have the Java Virtual Machine or will it conflict with JDK?

View PostBigAnt, on 24 Jan, 2009 - 09:22 AM, said:

If you installed the java compiler and such from sun you may have to modify the class path to recognize the commands without typing them out fully each time ie javac instead of c://programfiles/myjavalocal/javac.exe.


I'm sorry but, I'm a very beginner. How do I modify the class path?


The class path in windows can be modified by right clicking on my computer and clicking properties, then click on advanced and environment variables. Then in the bottom square you will need to find PATH and add ; and then the path to the files. This is of course on windows XP
Was This Post Helpful? 0
  • +
  • -

#6 villalandron  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 153
  • Joined: 24-September 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 12:10 PM

View Postmarkhazlett9, on 24 Jan, 2009 - 10:58 AM, said:

View Postvillalandron, on 24 Jan, 2009 - 10:56 AM, said:

View Postmostyfriedman, on 24 Jan, 2009 - 09:02 AM, said:

do you have the the java virtual machine installed on your computer?


Do I need to have the Java Virtual Machine or will it conflict with JDK?

View PostBigAnt, on 24 Jan, 2009 - 09:22 AM, said:

If you installed the java compiler and such from sun you may have to modify the class path to recognize the commands without typing them out fully each time ie javac instead of c://programfiles/myjavalocal/javac.exe.


I'm sorry but, I'm a very beginner. How do I modify the class path?


The class path in windows can be modified by right clicking on my computer and clicking properties, then click on advanced and environment variables. Then in the bottom square you will need to find PATH and add ; and then the path to the files. This is of course on windows XP


I hope I am not being too much of a pain in the butt. I have vista but figured out how to modify. I don't think I am doing this right though. Here is what I did. I created a new path and named it path2, the value that I put is as follows: C://programfiles/java/javac.exe. Still not working. Any ideas? Thank you in advance.
Was This Post Helpful? 0
  • +
  • -

#7 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 01:12 PM

add to the existing path. Do this by clicking on the path variable and clicking edit, then go to the end and add your java bin directory to the list.

ie if your path to your java bin was: C:\Program Files\Java\jdk1.6.0_02\bin This is what you would add to the end of the path, preceded by a semicolon.
Was This Post Helpful? 0
  • +
  • -

#8 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1813
  • View blog
  • Posts: 20,232
  • Joined: 17-March 01

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 01:14 PM

Edited thread title to reflect content.
Was This Post Helpful? 0
  • +
  • -

#9 markhazlett9  Icon User is offline

  • Coding is a lifestyle
  • member icon

Reputation: 60
  • View blog
  • Posts: 1,666
  • Joined: 12-July 08

Re: javac is not recognized as an internal or external command

Posted 24 January 2009 - 01:25 PM

View Postvillalandron, on 24 Jan, 2009 - 11:10 AM, said:

View Postmarkhazlett9, on 24 Jan, 2009 - 10:58 AM, said:

View Postvillalandron, on 24 Jan, 2009 - 10:56 AM, said:

View Postmostyfriedman, on 24 Jan, 2009 - 09:02 AM, said:

do you have the the java virtual machine installed on your computer?


Do I need to have the Java Virtual Machine or will it conflict with JDK?

View PostBigAnt, on 24 Jan, 2009 - 09:22 AM, said:

If you installed the java compiler and such from sun you may have to modify the class path to recognize the commands without typing them out fully each time ie javac instead of c://programfiles/myjavalocal/javac.exe.


I'm sorry but, I'm a very beginner. How do I modify the class path?


The class path in windows can be modified by right clicking on my computer and clicking properties, then click on advanced and environment variables. Then in the bottom square you will need to find PATH and add ; and then the path to the files. This is of course on windows XP


I hope I am not being too much of a pain in the butt. I have vista but figured out how to modify. I don't think I am doing this right though. Here is what I did. I created a new path and named it path2, the value that I put is as follows: C://programfiles/java/javac.exe. Still not working. Any ideas? Thank you in advance.



My bad, sorry couldn't help you there, haven't done too much work on vista....
Was This Post Helpful? 0
  • +
  • -

#10 superchiku  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 9
  • Joined: 22-January 09

Re: javac is not recognized as an internal or external command

Posted 25 January 2009 - 12:17 AM

right click on my computer go to properties then advanced then enviroment variables in that u ll have the variable named path...
append at the end od that path variable.the full path where ur javac and java is
Was This Post Helpful? 0
  • +
  • -

#11 villalandron  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 153
  • Joined: 24-September 08

Re: javac is not recognized as an internal or external command

Posted 25 January 2009 - 09:30 AM

View PostBigAnt, on 24 Jan, 2009 - 12:12 PM, said:

add to the existing path. Do this by clicking on the path variable and clicking edit, then go to the end and add your java bin directory to the list.

ie if your path to your java bin was: C:\Program Files\Java\jdk1.6.0_02\bin This is what you would add to the end of the path, preceded by a semicolon.


I think I edited the path properly because after I type
javac MyFirstProgram.java it pauses for a while and then it comes back to C:\Users\Jay. After that, I am trying to do things by my book, it tells me to type java MyFirstProgram and I should be able to see Hello World! display. Instead, I get Exeption in thread 'main' java.lang.NoClassFound Error: MyFirstProgram
Thanks for any help
Was This Post Helpful? 0
  • +
  • -

#12 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: javac is not recognized as an internal or external command

Posted 25 January 2009 - 11:33 AM

Does this class have a main method?
Was This Post Helpful? 0
  • +
  • -

#13 skailey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 12-February 08

Re: javac is not recognized as an internal or external command

Posted 21 January 2010 - 04:11 PM

Hello... I have made sure I have jdk1.6.0_18 installed and my Path is correct, yet... when I try to use just javac... I get the "javac is not recognized as an internal or external command" message. I am not sure what else to do... any advice would be appreciated.

Thanks!
Was This Post Helpful? 0
  • +
  • -

#14 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 484
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: javac is not recognized as an internal or external command

Posted 21 January 2010 - 04:14 PM

This thread is almost a year old!

You should have just created your own :)
Was This Post Helpful? 0
  • +
  • -

#15 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2696
  • View blog
  • Posts: 10,556
  • Joined: 15-July 08

Re: javac is not recognized as an internal or external command

Posted 21 January 2010 - 04:19 PM

View Postskailey, on 21 Jan, 2010 - 05:11 PM, said:

Hello... I have made sure I have jdk1.6.0_18 installed and my Path is correct, yet... when I try to use just javac... I get the "javac is not recognized as an internal or external command" message. I am not sure what else to do... any advice would be appreciated.

Thanks!


Mind showing us your path?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2