Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JDK Issue - Javac not recognised

  • 04-10-2014 04:32PM
    #1
    Registered Users, Registered Users 2 Posts: 218 ✭✭


    I'm using a different laptop and have installed the JDK and for some reason I'm getting the "javac is not recognised" error when I try and compile my programs in command prompt. I've specified the path files in environmental variables. Any ideas of other solutions I should look into? Thanks in advance.
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 403 ✭✭counterpointaud


    Post the contents of your PATH variable, and also the location(s) of javac.exe
    echo %PATH%
    
    dir javac.exe /s /p
    
    (might take a while)


  • Registered Users, Registered Users 2 Posts: 7,180 ✭✭✭Talisman


    JDK installation instructions : Updating the PATH Environment Variable


  • Registered Users, Registered Users 2 Posts: 6,271 ✭✭✭Buford T Justice


    what os are you using?


  • Registered Users, Registered Users 2 Posts: 1,192 ✭✭✭TarfHead


    I have a similar, but different, problem.

    I am new to Java, just started tuition in 2 weeks ago. I was provided with instructions for installing the SE Development kit on my PC (Win7, 64 bit) and for using Notepad++ to write code and macros for Compile, Run & Compile & Run.

    Everything is installed and the Notepad++ macros defined. JDK installed using 'jdk-8u20-windows-x64.exe'

    The Compile option runs OK, i.e. no reported errors. In other words, the macro is able to locate javac.exe.

    The Run macro fails with message;

    Process started >>>
    Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
    has value '1.7', but '1.8' is required.
    Error: could not find java.dll
    Error: Could not find Java SE Runtime Environment.
    <<< Process finished. (Exit code 2)

    The 'Run' macro comprises;

    cd "$(CURRENT_DIRECTORY)"
    java $(NAME_PART)

    When I look at the Windows Registry, using regedit, I see a value of 1.8 for Current Version in \HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit.

    I have seperately downloaded and installed the Java Runtime environment, but the error remains. JRE installed using 'jre-8u20-windows-x64.exe'

    And, when I run 'javac' and 'java' on the command line, they both work.

    Any hints, tips ?


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Update your notepad++, the java plugin is looking for an out of date version. Alternatively just edit the registry yourself. Maybe it's looking for 32bit java?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,192 ✭✭✭TarfHead


    Thanks
    The registry shows 1.8 and Notepad++ is 'reading' 1.7. I have uninstalled and installed Notepad++ several times.


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Notepad++ does not work with the latest java it seems, so you have to manually hack it - or download the old java that it expects.

    Try following all the steps here: https://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html

    Notepad++ config info here, mess around with this until fixed: https://www3.ntu.edu.sg/home/ehchua/programming/howto/CMD_Survival.html#NotePadPP
    Try editing JavaRun.bat and JavaCompile.bat.


  • Registered Users, Registered Users 2 Posts: 1,192 ✭✭✭TarfHead


    I copped on to a different solution. Instead of just the 'java' command and relying on Notepad++/Windows to resolve the path, I put in the full directory reference to java.exe and it now works fine.

    replace java $(NAME_PART)
    with C:\Program Files\Java\jdk1.8.0_20\bin\java $(NAME_PART)

    Thanks for your help


Advertisement