DOS not recognizing javac command

Teaching myself java without any programming experience. Trying to run "hello world" but error message reads 'javac' is not recognized internal or external command...
windows control panel says Java 2 SDK is loaded.
Help?
(if this question is too fundamental for this forum... feel free to direct me to the correct one) thanks

u need to set the path to bin (where the java compiler is located).
Goto controlpanel\system\advanced\environment variables.
In the system variables, if theres a path variable, click edit and add the following:
C:\j2sdk1.4.2_04\bin
or click new and type path add the above value and click ok.
NOTE: use the appropriate version of java. I dont know which version u r using.

Similar Messages

  • C:\program not recognized as command when trying to Run "asadmin"

    Hi everyone,
    I have installed sun one application server 7 on my windows XP machine. I have set class path for j2sdk1.4.2.
    but when i try to start application server or run "asadmin" from dos prompt, it get error like
    'C:\Program' is not recognized as an internal or external command,operable program or batch file.
    I have my j2sdk installed in C:\Program Files\Java\j2sdk_nb\j2sdk1.2.4.
    From information on the web i am sure that this is not related to Sun One studio, but more with my settings.
    Can anyone plz help me what to do

    It's probably because your path contains a space. I believe that you will have to enclose that path setting in double quotes in order for your classpath to be correctly set.

  • Can't run Batch files or Devnev (visual studio) - is not recognized .. command

    Getting the famous error :
    ... is not recognized as an internal or external command`*
    When & Where :
    not sure about the total range of the problem,
    Here I can't run batch files and "devneve.exe"
    sample Batch could be :
    @echo off   
    clr
    'clr' is not recognized ...
    **Here are the keynotes:**
     1. I run it as an admin (cmd)
     2. The Path variable seems to have anything needed, Powershell's path is also there sys32..v1
     3. I'm going into the current directory of devnev.exe ...
     4. ran also "devnev.exe"
     5. I don't have 2 cmd s in a known folder
     6. the autorun registries for command prompt were deleted
     7. the cmd extensions were disabled and re-enabled
     8. Avast IS 9 is running,
     9. The system seems to be fine
     10. all .Net frameworks are installed
     11. for a test jetAudio or ILDasm could be executed from the cmd
    Win 8.1 Pro , CPU i7, VS 2013 upd2

    thanks,
    this was one of the silliest problems I've ever encountered, my bad fault,
    the file is DevEnv not DevNev...!
    but about the clr, don't know from when I added them to my batches, but I'm sure the scripts were working correctly a time ago, maybe by a mistake I changed them, I thought it is the most known command, but I was wrong, there is a long time gap between me
    and DOS.

  • System Not Recognizing Javac

    Sytem: Windows XP Home Edition
    Java Version: 1.4.0
    'javac' is not an internal or external command, operable program or batch file.
    How do I set my classpath? Please dummy down starting at the Advanced Tab in System Properties. =) That is, before I break down in tears of holy frustration.
    Thanks in advance.

    That is the file path that is in my system. The location of the javac.exe is in:
    C:\Program Files\jsdk1.4.0\bin
    That is why I am banging my head. Also, I didn't see an option while installing Java to have the files rooted directly on the c drive and not under program files.

  • Shell not recognizing my command

    Hello all,
    First post here! I hope I will be able to get support from this great community! So currently I am a college student who just registered for a class about concurrent programming with java for next semester. It has been awhile since I've programmed in Java, nor have I ever programmed in a concurrent way. To better prepare myself and refresh my memory of java, I decided I should go through some of the current semester's homework for the class. The homework I am working on is to create a command shell in Java. The homework requires me to use the Thread class to do this. It also requires me to create a Command class, and any other class that I see as required to do this.
    So what I have is this, an abstract Action class implementing Runnable that carries a String to mark it as a certain command.
    public abstract class Action implements Runnable{
         String command;
    }My first command testing class is Dir which extends the Action class.
    public class Dir extends Action{
         String command;
         public Dir(){
              this.command = "dir";
         //lists all files and directories in C
         public void run() {
              File folder = new File("C:/");
             File[] listOfFiles = folder.listFiles();
             for (int i = 0; i < listOfFiles.length; i++) {
               if (listOfFiles.isFile()) {
         System.out.println("File " + listOfFiles[i].getName());
         } else if (listOfFiles[i].isDirectory()) {
         System.out.println("Directory " + listOfFiles[i].getName());
    }I also have the Command class which is a requirement for this homework.  This carries a list of available Action(s). I think this is where the problem lies.//the Command class
    public class Command implements Runnable{
         private String action;
         private ArrayList<Action> actions;
         private Command(String action){
              this.action = action;
              this.actions = new ArrayList<Action>();
         //the creator
         public static Command create(String a){
              return new Command(a);
         //adds a command to the ArrayList
         public void addCommand(Action a){
              this.actions.add(a);
         //runs the command
         public void run() {
              int cmd = 0;
              if(cmd != actions.size()){
                   while(cmd != actions.size()){
                        if(actions.get(cmd).command == action){
                             actions.get(cmd).run();
                        else{     
                             cmd++;
              if(cmd == actions.size()){
                   System.out.print("No such command\n");
    Here is my main classpublic class main{
    public static void main(String[] args) throws IOException, InterruptedException{
         for (;;) {
    System.out.print("% ");
    System.out.flush();
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String line = in.readLine();
    int numberOfCommands = 0;
    //converts the "line" string to an array of chars
    char[] aline = line.toCharArray();
    //knows that there is at least one command if line has something
    if(line.length() > 0){
         numberOfCommands++;
    //finds the number of commands
    for(int i = 0; i != line.length(); i++){
         if(aline[i] == '&'){
              ++numberOfCommands;
    //initializes a new ArrayList of strings for the commandS
    ArrayList<String> acommands = new ArrayList<String>();
    //adds a new command to the list
    //& separates every command
    StringTokenizer st = new StringTokenizer(line, "&");
    while (st.hasMoreTokens()) {
    acommands.add(st.nextToken());
    //the Thread
    Thread t[] = new Thread[numberOfCommands];
    //runs the command
    for (int i=0; i < numberOfCommands; i++) {
    String c = acommands.get(i);
    Command cmd = Command.create(c);
    cmd.addCommand(new Dir());
    t[i] = new Thread(cmd);
    t[i].start();
    for (int i=0; i < numberOfCommands; i++) {
    t[i].join();
    When typing in "dir" into the mock command shell,  all I receive back is that there is no such command, which is something I added to the code to inform the user that there is no such command.  In this case though, I know for a fact there is such a command and it is the only command.   I have tested the function that displays all the files and directories.  I know for a fact that it works.  However my problem is getting the shell to recognize that the Dir command does exist and running the run() method in the Dir class.  Can somebody help me figure out where I made a mistake?  Thank you for your patience! I know its a long post...
    Edited by: dnguyen1022 on Apr 26, 2009 5:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Thanks to the both you, I was able to get some different type of result. However this time with this code:
    //runs the command
         public void run()
              int cmd = 0;
              if ( cmd != actions.size() )
                   while ( cmd != actions.size() )
                        String possibleAction = (actions.get(cmd)).command;
                        if ( possibleAction.equals(action) )
                             actions.get(cmd).run();
                        else
                             cmd++;
                   if ( cmd == actions.size() )
                        System.out.print("No such command\n");
         }It now gives me a error dealing with a thread..
    Exception in thread "Thread-0" java.lang.NullPointerException
    %      at Command.run(Command.java:33)
         at java.lang.Thread.run(Unknown Source)Line 33 is the line in which I compare the two strings.....if ( possibleAction.equals(action) )......However if I switched it around to be
    if ( action.equals(possibleAction) ), I no longer receive the error, but it tells me no such command is found. What is the difference between these two comparisons?

  • Javac -help:  'javac' not recognized...why?

    hi all,
    i just installed j2sdk1.4.0_02, but i have a problem. in the dos prompt, when i type C:\>javac -help, it results in a 'javac' is not recognized error. why?
    my PATH enviroment variable is this:
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ActivCard\ActivCard Gold\resources;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\j2sdk1.4.0_02\bin\javac.exe
    what am i doing wrong?
    thanks,
    jeff

    Hi, I installe dthe sdk1.4.0 but have no
    C:\j2sdk1.4.0_02 dir (or anything relating to java).
    Did I not do something right? I can run the java
    command but not javac.If you don't have a directory similar to j2sdk1.4.0_02 then you did something wrong. You can try to search your system for javac.exe. If you post the exact steps you went through, someone here may be able to
    help you.

  • My javac dose not work

    my javac dose not work
    how do i fix it?
    'javac' is not recognized as an internal or external command,
    operable program or batch file

    Original reply #4:
    arian wrote:
    click the my computer icon with the right button of mouse, select properties, under advanced tab click Environment Variables, in the system variables section edit Path parameter, add to it the folder where the jdk is installed. after you click apply, open the cmd from scratch and try it. if you've added it correctly, the command will be recognized.
    ArianArian, please stop advertising your homepage here.

  • Syntax for javac command line in DOS

    Can anyone help me with the proper syntax fror the javac command line? Based on the Java Tutorial, I type the following line while in: C:\Program Files\Java>
    c:\progra~1\java\bin\javac hellow~1.jav
    This returns the following error message:
    javac: invalid flag: hellow~1.jav
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    Rest deleted, you get the drift. A long time has passed since I have used DOS, but I thought that options were just that; they were not essential to run a program. If they are necessary, how do you set an option? for example, I have tried the command:
    C:\Program Files\Java>c:\progra~1\java\bin\javac -g hellow~1
    which gives me the following error:
    javac: invalid flag: hellow~1
    I would really appreciate any suggestions anyone out there has for solving this apparently simple & stupid problem.

    Many thanks for these suggestions. I finally got javac to work by putting the file name HelloWorldApp.java inside of quote marks (i.e. "HelloWorldApp.java"). The program compiled the file, & I now have a HelloWorldApp.class file in my java directory. Unfortunately, I am now having trouble with the next tutorial step: getting java to use the file.
    I am discovering there are some very strange things about DOS since the last time I used it. For example, the cd command recognizes either cd c:\progra~1\java OR c:\"Program Files"\java. If the quote marks are omitted a "file not found" error is returned. There seems to be some sort of problem with ways that long file names are dealt with in DOS. I notice that many contribs to this list enter long file names or directories without quote marks; indeed, this is standard format in the java tutorial. This is probably a really dumb question, but is there someway to tell DOS to recognize long names without quote marks?
    Once again, thanks for the help.

  • 'javac' is not recognized

    Good Morning Everybody!
    I am a newbie in Java and I want to start writing my first application.
    I did write my code and ready to compile it.
    01/21/2008 10:14 AM <DIR> ..
    01/21/2008 10:14 AM 250 first.java
    C:\java\main\src\january>javac first
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    C:\java\main\src\january>java first
    Exception in thread "main" java.lang.NoClassDefFoundError: first
    Here is my code:
    Public class first {
    public static void main(String[] args) {
    for (int i=1;i<=50; i++)
    System.out.println(i);
    What am I doing wrong?

    now I am getting the following error message:
    C:\java\main\src\january>dir
    Volume in drive C has no label.
    Volume Serial Number is 44A4-79F1
    Directory of C:\java\main\src\january
    01/21/2008 02:11 PM <DIR> .
    01/21/2008 02:11 PM <DIR> ..
    01/21/2008 02:11 PM 257 first.java
    1 File(s) 257 bytes
    2 Dir(s) 7,320,764,416 bytes free
    C:\java\main\src\january>javac first.java
    C:\java\main\src\january>dir
    Volume in drive C has no label.
    Volume Serial Number is 44A4-79F1
    Directory of C:\java\main\src\january
    01/21/2008 02:12 PM <DIR> .
    01/21/2008 02:12 PM <DIR> ..
    01/21/2008 02:12 PM 413 first.class
    01/21/2008 02:11 PM 257 first.java
    2 File(s) 670 bytes
    2 Dir(s) 7,320,764,416 bytes free
    C:\java\main\src\january>java first
    Exception in thread "main" java.lang.UnsupportedClassVersionError: first (Unsupported major.minor version 50.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    C:\java\main\src\january>java first.class
    Exception in thread "main" java.lang.NoClassDefFoundError: first/class
    C:\java\main\src\january>

  • 'JAVAC' is not recognized as an...

    'Javac' is not recognized as an internal or external command, operable program or batch file.
    Is the text I was awarded with.
    I placed my Java folder in C:\ and put my HelloWorldApp.java in the folder. I went into Command and typed in "cd C:\Java" and got into it. Next, I typed in dir, and was given the list. After doing such I typed in "javac HelloWorldApp.java" (With out the quotes, of course.) It gave me this text exactly, "'JAVAC' is not recognized as an internal or external command, operable program or batch file." Where did I go wrong? Any advice?

    Ok, why don't you put JDK somewhere that you won't find it, so you can't delete it on accident.
    Then just type javac is search.
    Copy the location of it (Under properties)
    then go to Control Panel, System, Adavnced, Enviromental Variables, New.
    Name it PATH and hit cntrl and v to paste the location of the Javac. Now you should be able to compile. :P

  • Trouble making path work for 'javac' is not recognized as an intern...

    Hi -
    I am trying to compile my HelloApp.java program and I get this message: 'javac' is not recognized as an internal or external command, operable program or batch file
    I know to go into the system and change my Environment Variable, but I'm not sure what to change it to. Right now I have it as: ...ger\;C:\foo\bar\> C:\java\samples\bin\javac Filename.java
    I've just installed java_app_platform_sdk-5_01-windows.
    Will you please give me step-by-step instructions to make my compiler work?
    Thank you.

    Its already solved: i installed with de windows installer (jdk-1_5_0_10-windows-i586-p.exe) jdk and jre in the same folder. With another installer (jdk-6-rc-windows-i586), in separate folders: no problem. Thank you.

  • 'mode' is not recognized as an internal or external command

    Hi All,
    We have installed Redwood Platform agent (windows-x86.exe -Windows (x86 32-bit)) on windows 2003 server.
    Windows Server version: u201CWindows 2003 x64 Ent R2u201D
    Installation drive is D:
    We have executed jobs (DOS Commands) on Windows server and it is completed successfully but it generating stderr.log apart from stdout.log file.
    stderr.log file content
    'mode' is not recognized as an internal or external command, operable program or batch file.
    We logged into Windows Server and checked for mode.com file in C:\WINDOWS\system32 folder. File mode.com is there in system32 folder.
    We have executed below commands on windows server and in stdout.log file we are not able to find mode.com file in system32 folder .Donu2019t know why it is not showing in stdout.log file. Please help me on this.
    ver
    C:
    cd WINDOWS\system32
    dir mo*
    whoami
    stdout.log file content:-
    Microsoft Windows [Version 5.2.3790]
    Volume in drive C has no label.
    Volume Serial Number is B00A-098F
    Directory of C:\WINDOWS\system32
    02/18/2007  11:05 AM           185,344 mobsync.dll
    02/18/2007  11:05 AM           134,144 mobsync.exe
    03/22/2006  07:00 AM           146,432 modemui.dll
    03/22/2006  07:00 AM            16,384 more.com
    03/22/2006  07:00 AM           555,008 moricons.dll
    03/22/2006  07:00 AM            12,288 mountvol.exe
                   6 File(s)      1,049,600 bytes
                   0 Dir(s)  122,509,565,952 bytes free
    nt authority\system
    On Windows XP we are not getting any error. We donu2019t have separate platform agent exe for x64 version.
    Version: SAP CPS 7.00 Patch 17.2
    Build:     M26.10-29140
    Thanks,
    Preethish

    Hi Anton,
    I tested on Windows XP and job not generated any stderr.log file .
    and below commnds display the mode.com file in stdout.log file.
    ver
    C:
    cd WINDOWS\system32
    dir mo*
    I tested same on another windows server (u201CWindows 2003 x64 Ent R2u201D ) and we get same error.
    That means we are getting this error only on Windows 2003 x64 server.
    and I cheked the security of mode.com file ( Properties -> Security) and it is same in both XP and 2003 server.I logged into 2003 server and executed mode cmd and it is executing. But it is not executing from Redwood.
    Thanks,
    Preethish

  • NewBie Question: Javac.exe Not recognized?

    Hi I just want to try out my v first hello world program in MOTOROLA IDEN SDK For J2ME Tech (v 1.2)
    I added a hello-world java file in the javafiles folder. Then when i try to build, an error occurred:
    "start building...
    compile D:\IAProject\TRIALCODEEXAMPLE\Example.java...
    javac.exe is not recognized as an internal or external command,
    operable program or batch file.
    Building over"
    Wat's the problem? Did i missed out any settings? THanks!!!!!

    THX, but I have new problem with this:
    Unhandled Exception in constructor java.lang.ClassNotFoundException: HelloWorld
    Error creating MIDlet HelloWorld
    sorce from UserGuide Motorola iDEN SDK..
    package  com.mot.j2me.midlets.helloworld;
    import  javax.microedition.lcdui.*;
    import  javax.microedition.midlet.*;
    public class  HelloWorld extends  MIDlet  {
    private  Form mainScreen;
    private  Display myDisplay;
    HelloWorld() {
    myDisplay = Display.getDisplay(this);
    mainScreen  = new Form("Hello World");
    StringItem  strItem = new StringItem("Hello", "This  is  a J2ME MIDlet."); mainScreen.append(strItem);
    public void  startApp()  throws  MIDletStateChangeException 
    { myDisplay.setCurrent(mainScreen);
    public void pauseApp() {
    public void  destroyApp(boolean  unconditional)   {
    }Why this code doesn't work??

  • Javac not recognized

    Here's the problem:
    I have been using JDK 1.3.1_02 for some time with no problem. I could compile and run the file through emacs or a command prompt.
    So, I've shutdown my computer and when I restart and attempt to comile, I get the infamous "javac not recognized as a command ..." So, I am stumped.
    My path is set correctly. I run Win XP(FYI). It will not compile through emacs or a command prompt now so I know it isn't emacs' fault. I theorize that it may have something to do with the Java Console Plugin b/c I can Run the program, but not compile. javaw.exe is in the jre for the Console, but javac.exe is not. Just my idea, but I don't know if that is it or how to fix it if it is. Please help if you can!

    a) try add YourJDKHome\bin into path variable in your environment variables
    replace YourJDKHome with the actual JDK installation directory in your win xp, e.g. something like
    c:\JDK 1.3.1_02\
    b) or altanatively, before you run javac just key in:
    path=YourJDKHome\bin
    remember to replace YourJDKHome with the actual JDK directory
    Then you can try javac again to see the result

  • Bash shell does not recognise 'java', 'javac' commands (Linux command line)

    i' ve used javac and java compile & execute commands to build the same application on the DOS command line with Windows - no problem.
    But when I try to compile the same file on the command line under Linux Redhat (7.1) using Bash shell i get <bash: javac: command not found> and <bash: java: command not found>.
    In both cases I'm using j2sdk1.4.2 downloaded from java.sun.com for Windows & Linux respectively.
    I make sure I have both the javac and the file I want to compile in the same directory ../j2sdk1.4.2/bin for both the Windows and the Linux applications.
    Is there something I need to do to get bash to recognise javac, java etc? Is there a different setup procedure?
    Any angles on this are much appreciated ..

    Have you tried these correctly..
    Set the CLASSPATH environment variable to include whichever directories you like, eg (on bash) type:
    export CLASSPATH=$CLASSPATH:.:<your java dirs>
    To make java easier to run, put the directory in which it is installed into your path:
    export JAVA_HOME=<where you installed java>
    Then do
    export PATH=$PATH:$JAVA_HOME/bin
    verify it has worked by simply typing
    java
    You can put all of these commands into the .*rc file for your shell, so that they are executed every time you open the shell. So if you are using bash you can put them into ~/.bashrc
    Read up setting the PATH and CLASSPATH for more info.
    This shall resolve the issue .

Maybe you are looking for