This entry is part 1 of 47 in the series Java

-by Travis

If you watched the first Java programming video, and you aren’t getting the desired outcome in your command prompt, most likely you don’t have the Java Development Kit loaded.  This is a quick tutorial on how to get you caught up to par .  If you didn’t have that problem, you can skip this tutorial.  Basically, the javac means Java complier, which translates what we type/read in java to something that the computer can understand, I like to call that language computerish.  I’m also just typing some stuff so this ad to the left won’t ruin the layout of this tutorial, but that should be enough text, Let’s get started..

 

 

 

  • Go to google.com
  • Search “Java JDK”
  • Most likely click the first link (which should be a download page: here is the current site: http://www.oracle.com/technetwork/java/javase/downloads/index.html)
  • There should be four options to download (Java Platform JDK, JDK + JavaFX Bundle, JDK+ Java Beans, and JDK+ Java EE Bundle)  any of those options are fine to download, to follow along with this tutorial, just download the Java Platform JDK.
  • Install just like any other program, with all the default settings (Click next a bunch of times, read Term&Conditions, etc.)
  • Click the Start Button (yes this is tutorial for Windows) and go to My Computer
  • Click on the main harddrive (for most it is C:)
  • Click on the Program Files folder> Open up the folder called Java
  • Click on the version of Java you downloaded (something like jdk1.6.0_12)
  • Open the bin folder
  • Inside the bin Folder look for the File called javac, and right-click on it and go to Properties
  • A new window should pop up giving the properties of the javac, there should be an attribute called Location.  Find the and copy the path (example: “C:\Program Files\Java\jdk1.6.0_ 12\bin”
  • Now we have the Path Location, so Click the start button again and right-click on the “Computer” and open up the “Properties”.
  • In the left side bar look for “Advanced system settings” and open that up (Click Continue)
  • Towards the bottom of the popup, Click “Environment Variables…”
  • Set up a new  User variable by clicking the top most “New..” button (under the “User variables for xxxxx”)
  • for the Variable name, type: Path
  • and for the Variable value, paste your Location of the javac, for example:     C:\Program Files\Java\jdk1.6.0_ 12\bin
  • Click OK on all three popups and close your System settings panel as well.
  • open up the command prompt again (Click start and type “cmd” in the search, press enter)
  • Type “javac” in the command prompt and your problems should be solved

Hope that helps, and look forward to developing some applications/games with you guys.

 

Peace,

-Trav

Next Lesson

48 Responses to Setting up JDK on you computer: So You Can Begin Java Programming

  1. John says:

    Hello I didn´t really get why this should be done? Can anyone replay :D thx

    • Viraj says:

      Hey John,
      Please go through the each step once again. Its illustrated in a very easy way. ( Its for Windows users)

      Further still if you don’t find any stuff post your comment. Anyone’d help you out I’m pretty sure.

      Peace.

  2. Raihan Taher says:

    Thanks, this tutorial helped me a lot, installing JDK in my pc..

  3. Samuel_Cazelli says:

    I had to reboot after create de variable in order to work.

  4. Thijs says:

    Thank you very much! It’s working perfectly now! :D A tip; when the ‘javac’ command doesn’t work in the end, you can try to restart the CMD. It worked for me. :)

    • Vivacior says:

      Thanks, Trav – worked like a charm, and I can honestly say this could have taken me days to find on my own.

      And Thijs – thanks for the tip. Definitely worked like that for me. Interestingly, “java” worked right away, but “javac” didn’t work until I restarted the cmd prompt.

      Cheers!

      • Ray says:

        i typed “javac” in the cmd and it said not recognized, even after restarting computer. typing “java” got me some info. what should i do?

  5. Brian says:

    I was only able to find Javacpl and Javaw. Are either of these close to Javac?

    Thanks

    • pavhan says:

      I had the same problem. Then I noticed I was finding the file javac in a wrong folder. I was in the “jre7″ folder where are the files Javacpl and Javaw, you mentioned, but you have to go to the “jdk1.7.0″ folder, where you definitely find file “javac”.

    • Chet says:

      Make sure you are in the right folder, Program Files or Program files(x86) you will have Java in both bud depending on which version of sdk you downloaded determines where javac is.

  6. jigish says:

    Hi First of all thanks alot for the tuts

    i have just started with this, and i would like to know
    what will be the name of Environment Variable???
    will it be javac?

    if yes then i tried with same also restarted my PC but its not working…

    looking forward to quick reply..
    thanks in adv

  7. Megamaaaz says:

    Can you tell us how to set this up in windows 7?

  8. Yann says:

    Hey, I use MAC OSX Lion, I have last Xcode 4 version from App Store, and I want programing java with it but I don’t know what. I don’t have crate java project. Thanks and sorry for my english i’m spanish but I’m working to improve my english hehehe. bye.

  9. Rory says:

    I have the same problem as Brian, after installing JDK, there is only a program files/java/jre/bin folder, and it does not contain a javac.exe. What is the next step in this case?

    • Viraj says:

      Hey there,
      Re check again! javac file will be found in the folder “C:\Program Files\Java\jdk1.7.0_02\bin”

      You need to search in the folder ‘bin’. ( type j once u reach this folder ). Right click that file and copy its location that’ll be useful little later.

      Further still if you don’t find any stuff post, your comment. Anyone’d help you out I’m pretty much sure.

      Peace.

  10. Rory says:

    Re. my last comment, I have fixed the problem by unistalling a previously installed version of the JDK (1.6), restarting, then installing 1.7. Also, the javac.exe file is under the program files (x86) folder if you’re running a 64 bit version of Windows.

  11. javac is also present there. look carefully. there are few files with similarity in names. u might be cofused

  12. Carl says:

    Hello, i do everything and when i type on the command “javac” open a black window (like the command pront) and then the window desappear!! What is wrong??? Thanks!
    From Costa Rica!! ;)

  13. FK says:

    on the download page there is no download for 32bit, only 64, what do i do?

    • Viraj says:

      Hey there,
      At the eclipse website you must get the download option for 32-bit computer. Have a deeper look again.

      Peace.

  14. M.J says:

    thankyou very nice work man

  15. Sean K says:

    I followed all of these instructions but for some reason in eclipse after I did the import shown in your java tutorial I still don’t have some of the jar file like the classes jar. Any help is greatly appreciated.
    Thanks

  16. j.j says:

    hi travis
    thank you
    this collection is graat!

  17. Atheeth says:

    thnx buddy

  18. John says:

    Thanx a lot for this tutorial, and also for videos in youtube.

  19. David says:

    Thanks man it worked.

  20. rajesh says:

    thanks for the tutorial ….

  21. Michael B. says:

    Guys if the cmd can’t find the command javac then go back into “environment variables” and make sure that you put the \bin at the end. When you copy and paste the location it does not have the \bin to it.

  22. oh thank you very much mybringback.com,, you helped me a lot.. although i starting creating now our thesis program which is a mobile application you helped me in installing jdk and other resources that i will need to develop our mobile application.. nevertheless can i ask you something?? it is possible that i can use either mysql or sqlLite as for database in java programming?? if yes how? please help me.. tnx..

  23. preetam says:

    other simple way to perform…follow the steps.
    1. open c drive
    2. open program folder
    3. open java folder
    4. open jdk folder….(“jdk1.7.0_05″ something like that)
    5. right click on bin folder.
    6. select command prompt
    7. type – javac
    8. enter

    thanks….

  24. JoeMoe says:

    Hi there,

    I think its worth mentioning how to append more paths to the path variable. I already had a path set and didn’t want to mess with it. But after some reading I found that you can add more path values just by adding a semicolon. For example

    PATH = C:\Program Files\myPath;C:\Program Files\myPath2;C:\Program Files\myPath3

    This might be helpful for anyone who may already have a path variable set.

  25. ken says:

    It is an exellent stuff and the tutorial is so clear and easy to fallow.

  26. Luksy says:

    TNX DUDE, THIS ACTUALLY HELPED ME.

  27. Nitish Kumar says:

    Hey man I like your tutorial on youTube keep it up:)

  28. akash says:

    can I just know which jdk to download for windows xp?
    win x86 oR win x64??
    and ur tuts are awsmmm… :)

  29. mirza says:

    i installed java jdk properly and it shows in the command prompt as well but you see i didn’t install the Eclipse , i took it from my friend and i copied it to D: drive . So when i double click the Eclipse file they say something like this
    failed to load the JNI shared library “C:\Program Files\Java\jdk1.7.0_10\bin..\jre\bin\server\jvm.dll”. Please help me on this

  30. Faizan says:

    Hi everyone!
    I have stuck in a problem. I have done all the steps correctly as they are illustrated. But when i started eclipse, a window popup and still showing

    “A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: C:\eclipse\bin\javaw.exe

    javaw.exe in your current PATH”

    please help me out of this ASAP.

  31. Faizan says:

    I uninstalled JDK and re-installed it. Now, i am facing the same problem as mirza’s. Resolve this problem ASAP please

  32. Dominiq says:

    Works perfectly for me, i just followed the instructions in this tutorial. Thanks, and let’s stard coding ! P)

  33. Jameel says:

    works !!!! thank u….

  34. Hayat Mohammad Niazi says:

    one of the best tutorial i ever have been through..! Amazing…

    THanks

  35. ray reelo mazarire says:

    Please assist me,

    i have found the javac file in C:\Program Files (x86)\Java\jdk1.7.0_17\bin but when i navigate to the file and right click then select properties i get a box with tabs such as general, previous version, Details, Compatibillity etc at the top but cant seem to locate attribute called Location.
    thanks in advance

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>