This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

compiler error

 
Ranch Hand
Posts: 75
Eclipse IDE AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i type javac classname.java an error comes that "javac is not recognized as an internal or external command,operable command or batch file"... whereas when i use Netbeans IDE,the program successfully runs...this means that my SDK is successfully installed so what is the problem?? please help...
 
Ranch Hand
Posts: 43
Eclipse IDE Oracle Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi saumyaraj

The problem is Windows does not know where javac.exe is located. When you ask for it by typing a command starting with it, it checks the current folder, then each of the folders it knows to check, without any results. To fix this, the java folder must be one it checks.

To do this, first locate where java is installed, and where javac.exe is located. This will probably be something along the lines of C:\jdk\bin\ or C:\Program Files\Java\jdk\bin\ - I do not use Java personally so I'm not sure.

Second, go to Windows Explorer, right click My Computer, go to Properties, the Advanced tab, Environmental Variables. Under System variables, look for Path. Do NOT remove anything here, but instead at the END of "Variable value" add a semicolon (;) and a space, followed by the path you found earlier.

Hope this helps
 
Saumyaraj Zala
Ranch Hand
Posts: 75
Eclipse IDE AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankyou... it worked
 
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
saumyaraj,

Since you are using NetBeans, you may want to be sure that your javac command invokes the same compiler that NetBeans is using. I have noticed that it is pretty easy to end up with more than one compiler on one computer, especially when you are getting started.

To find out which one NetBeans is using, choose "Tools / Java Platforms" from the IDE menubar. The Java Platform Manager dialog box will appear. Near the top, it will have two text boxes, one labeled, "Platform Name," and the other labeled, "Platform Folder." Most likely, if you are just getting started, there will only be one platform on your computer ("platform" basically refers to a release of the Java Development Kit). That one platform will have the word "(Default)" next to it in the Platform Name text box. (If you have more than one, you probably want the default platform, though, if you are compiling a file you created in the NetBeans IDE editor, you want the one that came with the platform you are using to development the project that file is part of; if that makes no sense, just ignore it, as you probably only have one platform installed right now anyway.)

When you take Vimal's advice, the entry you want to add to the end of the PATH environment variable will be the full path listed in Platform Folder, but with "\bin" added to the end.

If you ever do install a new platform, even for an upgrade, be sure to change your PATH variable so it points to the directory with your new javac.exe file in it, not the old one. (Compiling with an old and a new compiler can create some maddening debugging problems, which some people refer to as the disease called "versionitis." You don't want to get versionitis, I assure you.)

Good luck.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic