Javac is not recognized as an internal or external command (solved)

Javac is not recognized as an internal or external command (solved)

5
NewbieNewbie
5

    Jan 07, 2014#1

    I have followed the instructions on Power Tips as far as how to set up UEStudio to compile and run a Java application, but I still get the 'javac is not recognized as an internal or external command...' error message. I got my Path variable set up too.

    6,675585
    Grand MasterGrand Master
    6,675585

      Jan 08, 2014#2

      I do not create Java applications and therefore cannot help on this problem with verified hints.

      Do you have verified in a command prompt window that javac is recognized as command?

      You can do this verification also directly in UEStudio by opening Advanced - DOS Command, enter javac and press button OK. The captured output should contain information from javac.exe. If you get the same error message captured, the path to javac.exe is not correct specified in environment variable PATH or there is simply no javac.exe.

      I can see in the compiler config files for Java Console and Windows Applications an option for selecting the compiler: javac or jikes. Perhaps your version of Java comes with jikes.exe and requires therefore the selection of jikes as compiler in the compiler options of the UEStudio project.

      Further, I suggest to enable at Build - Advanced Build Options the option Show build commands when executing to see in output window also the commands UEStudio uses to build the Java project. Perhaps you can see now what is the problem.
      Best regards from an UC/UE/UES for Windows user from Austria

      5
      NewbieNewbie
      5

        Jan 09, 2014#3

        Well after much experimenting and scouring the web I managed to get it going. But I do have two questions:

        1. The console window closes immediately when executing the program. I know how to add a line of code to keep it open in C++. But how would I do it in Java?

        2. I wrote a short program that asks the user to input a number, but it doesn't appear that you can input data in the lower output window, so if I write a program that requires the user to input data, I would have to use the DOS box correct?

        6,675585
        Grand MasterGrand Master
        6,675585

          Jan 09, 2014#4

          I cannot answer your first question as I'm not a Java programmer.

          But I can help perhaps with your second question. The Run App command builds an application if necessary and then executes it. It is by default not designed for console applications with user input. The possibilities are:
          1. You configure a Project Tool in menu Advanced which runs the built application in a DOS box with the appropriate command line. That makes it possible to input data during execution. The project tool can be added to the toolbar for easy execution and a hotkey can be also assigned to the project tool for fast execution by key.
          2. It might be (= never tested by me) also possible to open Build - Select Compiler, click on Edit configuration, click on Make configuration local (save in project directory) and modify now in section [Execute Application] the line Cmd0 to start a batch file with appropriate parameters which really executes the application based on the parameters and which contains command Pause at end.
          Best regards from an UC/UE/UES for Windows user from Austria

          2
          NewbieNewbie
          2

            Javac is not recognized as an internal or external command (still not solved)

            May 12, 2014#5

            I'm just starting out on learning Java, something I've been putting aside for years and I'm using UEStudio (version 14.20.0.1003) as an IDE, although I've been using UltraEdit for years.

            However I'm running into problems with the compliation of my first "Hello World" code.

            I have followed the instructions on Power Tips as far as how to set up UEStudio to compile and run a Java application, but I still get the 'javac is not recognized as an internal or external command...' error message.

            I've looked through the forum for help and I know this has been solved before, but it didn't really say how.

            INSTALL IS CORRECT
            I've installed Java SE Development Kit 7 Update 55 (64 bit) and I've adusted my system path to include the path...

            I can open a dos box and type "JavaC" and it works.
            I can also manually compile My JavaHelloWorld app.

            Code: Select all

            PATH=C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\window
            s;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Compone
            nts\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
            C:\Program Files\Java\jdk1.7.0_55\bin\

            Code: Select all

            ;C:\Program Files (x86)\IDM Computer Solutions\UEStudio\;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\;
            This PATH value is also visible to Ultraedit if I run Advanced>DOS Command> SET
            Also If I run javac through the same method, I can see javac being run correctly.

            SYMPTOM
            When I create a Java Console project from scratch - OR use a template - when I hit the COMPILE button I get:

            Code: Select all

            --------------------Configuration: MyJavaApp - Debug--------------------
            javac -target 1.7 -d .\ -classpath .; -g @MyJavaApp.object
            'javac' is not recognized as an internal or external command,
            operable program or batch file.
            jar cvfm MyJavaApp.jar MyJavaApp.man @MyJavaApp.resource
            'jar' is not recognized as an internal or external command,
            operable program or batch file.
            MyJavaApp.jar - 0 error(s), 0 warning(s)
            
            (note - I've added the Build>Advanced Build Options>Show build commands when executing)

            Not sure if it makes any difference, but I'm running Windows 8.1 (urgh)

            Any thoughts?

            6,675585
            Grand MasterGrand Master
            6,675585

              May 12, 2014#6

              I do not have the JDK installed and therefore all below is not verified by me. I can only write about what I see in the Java Compiler configs.

              Click on menu item Select Compiler in menu Build and click on button Edit configuration.

              You see the configuration for a Console (java = java) or Windows (java = javaw) Java application. In both configurations there is the block

              [Variables]

              EOPT = $(VM) $(Launcher Options)
              COPT = $(Compiler Options) $(Input Paths) $(Character Encoding) $(Target VM) $(Source) $(ExtDirs)
              JDKv = $(HKEY_LOCAL_MACHINE\SOFTWARE$6432\JavaSoft\Java Development Kit\CurrentVersion)
              CPATH = $(HKEY_LOCAL_MACHINE\SOFTWARE$6432\JavaSoft\Java Development Kit\$(JDKv)\JavaHome)
              java = java

              [Environment]

              PATH = $(CPATH)\BIN

              The last line makes it clear that the PATH as defined by the user and system environment settings is not used when building a Java application. UEStudio replaces the standard value of environment variable PATH by a self defined value containing just the path to the binary directory of the used compiler which is in this case the directory BIN of the used JDK. That is usually the best method as it should not be necessary to have the binary directory of all compilers in the user's respectively system PATH just for being able to compile something.

              You could click on button Make configuration local (save in project directory). Then comment the line with PATH definition by inserting at beginning of the line the character # and click on button Save configuration.

              Another possibility is to verify that the JDK is correct registered in Windows registry. Start Regedit.exe and open registry key
              • 64-bit Windows:
                HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit\CurrentVersion
              • 32-bit Windows:
                HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion
              The default string at top on right side of this registry key should contain the JDK version string. Now check in Windows registry key:
              • 64-bit Windows:
                HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit\JDK version\JavaHome
              • 32-bit Windows:
                HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\JDK version\JavaHome
              The default string at top on right side of this registry key should contain the path to the directory containing the subdirectory bin.

              For your installation this should be C:\Program Files\Java\jdk1.7.0_55

              I'm wondering that the JDK was not installed into C:\Program Files (x86)\Java\jdk1.7.0_55 as 32-bit applications are usually not installed on Windows x64 into the program files folders for 64-bit applications. You use definitely a 64-bit Windows 8.1.

              Do you have installed 64-bit JDK? What was the reason to install 64-bit version and not 32-bit version?

              The reason was hopefully not because of using Windows 8.1 x64.

              UEStudio is a 32-bit Windows application and therefore contains the configurations also only for 32-bit compilers.

              I know that there is a 32-bit and a 64-bit Java JDK and users can install only 32-bit, only 64-bit or both. But Sun Java as often installed for usage in browsers is mainly installed in 32-bit version and Sun supports automatic updates only for 32-bit version. A user who installs also the 64-bit version of Sun Java must always manually check for an update and also manually download and install the update for 64-bit version. See Sun Java articles Which Java download should I choose for my 64-bit Windows? and What is Java Auto Update? How do I change notify settings?

              The reason is quite simple: most users use only the 32-bit version of their browser because not knowing that for their favorite browser also a 64-bit version is most likely available. And most Java apps are written for 32-bit version of Sun Java because the companies producing those Java applications do not want to build and test their applications always twice just because of a minority of users (according to web usage statistics) using a 64-bit browser and therefore using 64-bit Sun Java. See the PC World article Should I use the 32- or 64-bit version of Internet Explorer?

              Microsoft recommends to use the 32-bit version of Internet Explorer and it is in the meantime not really easy to use the 64-bit version of IE. Reason: the big majority of Internet Explorer plugins, Java applications, and other applications executed within browser are written for 32-bit browsers/Java although more and more plugins/apps are rewritten and are in the meantime also available as 64-bit version. See for example the MSDN article IEInternals - Q&A: 64-Bit Internet Explorer.
              Best regards from an UC/UE/UES for Windows user from Austria

              2
              NewbieNewbie
              2

                May 12, 2014#7

                Thanks Mofi,

                I think you've got the exact answer there.

                I had installed the x64 version.

                After uninstalling x64, installing the x86 and then changing the Path it works fine.

                MASSIVE thanks.. I really hadn't thought of that and your full answer is massively insightful and helpful.

                Cheers

                Jonny