Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Trying to install Java on Windows Vista

Options
  • 01-07-2009 5:45pm
    #1
    Registered Users Posts: 43


    Hi, I'm trying to install the java development kit onto my laptop but I've no idea how to set the path. The kit is located under C:\Windows\System32 so do I just add/change a path in the enviroment/system variables? I did try this but I still got "javac is not recognised as an external or internal command ". Any help would be appreciated.


Comments

  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    Find the bin folder in the JDK install directory and add that to the path. It would probably be best to reinstall it somewhere other than the System32 folder as well. It is not generally a good idea to put applications there.


  • Registered Users Posts: 43 bookworm192398


    Ok, I moved it to my bookworm192398 folder and put C:/bookworm192398/jdk/bin for the path under enviroment variables but I'm still getting the javac is not recognised error. Theres a class path and a path in the enviroment variables and I've been editing the path, is that right?


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    OPen a command prompt and type "path"

    If you dont see the path to java there your OS wont find it when you type in javac.


    Also, did you install the JDK or the JRE, AFAIK there is not compiler (javac) bundled with the JRE, only the JDK.


  • Registered Users Posts: 43 bookworm192398


    I installed Java SE Development Kit 6u14 from https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter.

    I installed it in C:\bookworm192398\Downloads.

    I've set the path to C:\bookworm192398\Downloads\jdk-6u14-windows-i586
    and this is what comes up when I type path in command prompt. I'm still getting the javac not recognised error.


  • Registered Users Posts: 1,998 ✭✭✭lynchie


    You sure thats where it is installed?
    The default location would be C:\Program Files\Java\jdk1.6.0_14. So you did you manually tell it to install in C:\bookworm192398\Downloads\jdk-6u14-windows-i586 ? If so.. then the path should be C:\bookworm192398\Downloads\jdk-6u14-windows-i586\bin


  • Advertisement
  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    lynchie wrote: »
    You sure thats where it is installed?
    The default location would be C:\Program Files\Java\jdk1.6.0_14. So you did you manually tell it to install in C:\bookworm192398\Downloads\jdk-6u14-windows-i586 ? If so.. then the path should be C:\bookworm192398\Downloads\jdk-6u14-windows-i586\bin

    ^^ What he said. The exact directory that the exe is in needs to be on the path.

    For some development applications you sometimes need to set a new environment varibable called JAVA_HOME which would be the install directory in your post. In fact it may be even better to set it anyway and then add %JAVA_HOME%\bin to the path as it makes it a little easier to switch java versions if you are working with multiple ones in the future , by simply changing the JAVA_HOME environment variable.


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Just download from here and put it in a folder called d:/whatever/jdk1.6

    add d:/whatever/jdk1.6/bin to your path


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    I just tried it and javac is not included on the jdk 1.6 update 14 download for some reason

    Im using update 13 and it is there...

    Downloaded it 4 times, twice it was some JRE halfbreed, twice it was fine. I guess there might be a dodgy mirror out there...


  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    GreeBo wrote: »
    I just tried it and javac is not included on the jdk 1.6 update 14 download for some reason

    Im using update 13 and it is there...

    Downloaded it 4 times, twice it was some JRE halfbreed, twice it was fine. I guess there might be a dodgy mirror out there...

    Must be a JRE download mislabled as a JDK I'd say.


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    marco_polo wrote: »
    Must be a JRE download mislabled as a JDK I'd say.

    Yeah, though it does seem to be the correct size (72.5mb)


  • Advertisement
  • Registered Users Posts: 43 bookworm192398


    OK, I've downloaded update 13 and its installed under C:\Program Files\Java\jdk1.6.0_13 and I've set the path to C:\Program Files\Java\jdk1.6.0_13\bin.

    Now I'm no longer getting the javac is not recognised error but when I try to compile a file it says file not found, do I need to save the file somewhere in particular?


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Can you paste exactly what you are getting on the screen (and what you are typing)

    you will either need to give the full path to the class OR the full path to javac (assuming your java file is not living in the java/bin folder)


  • Registered Users Posts: 43 bookworm192398


    For javac on its own:

    C:\Users\bookworm192398>javac
    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
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files and annotati
    on processors
    -cp <path> Specify where to find user class files and annotati
    on processors
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -proc:{none,only} Control whether annotation processing and/or compil
    ation is done.
    -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
    o run; bypasses default discovery process
    -processorpath <path> Specify where to find annotation processors
    -d <directory> Specify where to place generated class files
    -s <directory> Specify where to place generated source files
    -implicit:{none,class} Specify whether or not to generate class files for
    implicitly referenced files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release

    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -Akey[=value] Options to pass to annotation processors
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system


    The file I'm trying to compile is just a basic hello world file I've called Test.java and saved to the desktop. When I try to compile I get this:

    C:\Users\bookworm192398>javac Test.java
    javac: file not found: Test.java
    Usage: javac <options> <source files>
    use -help for a list of possible options


  • Registered Users Posts: 515 ✭✭✭NeverSayDie


    The file is in your desktop folder, not "C:\Users\bookworm192398", which is probably why javac is giving you that error message. Either run the command from your desktop folder, or copy the .java file into the folder above and try it again.


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Ok so look at the error message again.
    "javac file not found: Test.java"

    Javac is telling you that it cant find Test.java.
    You are starting javac from
    C:\Users\bookworm192398

    But Test.java lives somewhere like
    C:\documents & Settings\bookworm\desktop

    Your options are:
    1) go to the desktop (in dos/cmd line) and run javac from there
    2) give the full path to Test.java when you call javac

    e.g
    javac C:\documents & Settings\bookworm\desktop\Test.java


    Also, is you class called Test or HelloWorld?
    In Java the (public) class name has to be the same as the file name
    e.g
    public class HelloWorld
    {
    }

    is saved in a file called HelloWorld.java

    likewise a file called Test.java has to contain a public class called Test.


  • Registered Users Posts: 43 bookworm192398


    And I am good to go! Thank so much everyone!:)


Advertisement