Java Basics:Getting Started with Java

Here we will discuss some basics topics related to Java.

  1. Where to download Java.
  2. How to install Java.
  3. Setting up the Environment Variables.
  4. Our First Java Program.
  5. How to compile a Java application.
  6. How to run a Java Application.
  7. Difference between important terms in Java (JDK vs JRE or J2SE vs J2EE..).

 

How to Download Java

Latest version of Java can be downloaded from Java Website.

Java Installation

There are no special requirements when installing Java.  Be sure that you have suitable permissions on your computer to install software. It can be installed like any other software (.exe).

Setting up the Environment Variables

After installing Java there are some environment variables that need to be set.

  • CLASSPATH : This environment variable points to the location of JDK home directory. It also contains the address of folder from where jars get loaded by ClassLoader (For more details of ClassLoader visit here)
  • JAVA_HOME : This environment variable will point to the location of Java home directory.

How to set environment variable in different platforms

Windows XP

To set up environment variables in Windows XP right click on the “My Computer” icon and select Properties. In the  Property window select the “ADVANCED”  tab and click on “ENVIRONMENT VARIABLES” . A window will appear were you can enter a new environment variable under System Variables by selecting New button.

Windows Vista / 7

To set up environment variables in Windows Vista / 7  right click  on “Computer” and select Properties. In  Property window select  “ADVANCED SYSTEM SETTINGS” and then select “ADVANCED” tab and click “ENVIRONMENT VARIABLES”. A window will appear were you can enter new environment variable under User/System Variables by selecting New button.

How to Check if Java is Installed

To check if your Java is installed properly open Command Prompt . To open command prompt write “CMD” in run command and hit enter. In the command prompt window write “java -version“.  If your Java is installed properly and all environment variables are configured correctly it will show the version of Java installed . Information reflected on the command prompt will be like

C:\Users\Jbt>java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode, sharing)

If there is any problem while installing or in setting up the environment variable, output on command prompt will be as shown below.

'java' is not recognized as an internal or external command,
operable program or batch file.

How to check if Java is up to date

To know if the Java installed on your system is up to date Click Here.

Our First Java Program

Though the popular first program to write in Java is” Hello World !! “,here we will write a program to print ” Hello JBT !! “. 🙂

Open any editor and write the below code.

public class FirstProgramme {
	public static void main(String args[]) {
		System.out.println("Hello JBT!");
	}
}

Save the file with the name “FirstProgramme.java” in folder “c:\jbt”. Please note that name of the file should be same as the name given to public class(For more details regarding class file rules click here). Once the file is saved, open the command prompt and change the working directory to “c:\jbt”, where your file is saved. Write “javac FirstProgramme.java to compile the Java code as below.

C:\Users\JBT>cd C:JBT

C:JBT>javac FirstProgramme.java

C:JBT>

If the java file is compiled properly the compiler will create a class file for  the sourceJava. It will be saved in the same location as the source file. Since no package is declared in the given code the .class file will be created in the same folder location.

Notice the difference for Java files  using package declaration. Let’s create another Java file as below.

package com.jbt;

public class FirstProgrammeWithPackage {
   public static void main(String args[]) {
   System.out.println("Hello JBT!");
  }
}

Save this file as “FirstProgrammeWithPackage.java” to “c:\jbt”. Now go to the command prompt and execute the below command.

javac -d . FirstProgrammeWithPackage.java

It will create the class file in a corresponding package(com.jbt).

Now that you know how to compile Java file with package and without package, the next step would be run these class files.

How to Run Java Application

Now that your  Java file is compiled we can execute the application using the “java” command as below.

Without Package

C:\JBT>java FirstProgramme
Hello JBT!

C:\JBT>

With Package

C:\JBT>java com.jbt.FirstProgrammeWithPackage
Hello JBT!

Or

C:\JBT>java com/jbt/FirstProgrammeWithPackage
Hello JBT!

 

Note*: The “java” command uses the class file name without its extension(.class).

With this we are done creating and running our very first Java application.

In the next section we will learn the difference between JDK and JRE.

Series Navigationjdk vs jre vs jvm >>
By | 2017-08-14T10:50:47+00:00 September 2nd, 2012|Core Java|174 Comments

About the Author:

174 Comments

  1. tony September 18, 2012 at 6:11 pm - Reply

    very good website

    • admin September 18, 2012 at 7:07 pm - Reply

      Thanks Tony :).

      • rwse April 15, 2014 at 9:46 am - Reply

        kk

  2. Tanveer Asim December 9, 2012 at 1:01 pm - Reply

    Website is good source of learning for biggener level quick learning. This website helped me alot.

  3. sudhir December 11, 2012 at 6:02 am - Reply

    Hi get this error after run the command
    Error : could not find or load the main class FirstProgramme

    please answer.

    • admin December 11, 2012 at 6:59 am - Reply

      Sent a mail to your id please check the same and try to provide source code so that we can have look into it.

      Thanks

      • manprit singh sahota August 28, 2013 at 6:07 pm - Reply

        plzz set the path.. ur problem will b solved.. use google to learn how to set path for java..

    • ankur December 15, 2014 at 11:06 am - Reply

      u r not using correct command.
      use java -version to check your java version

  4. mAxTeR December 31, 2012 at 8:54 pm - Reply

    Hi get this error after run the command
    Error : could not find or load the main class FirstProgramme

    please answer.

    the same ^ just answer what should we do so in the future people not need to wait abswer

  5. mAxTeR December 31, 2012 at 9:41 pm - Reply

    problem solved just set(or type) in cmdpromt.. setpath= C:Program FilesJavajdk1.7.0_10bin or where are ever you saved your jdk file i hope thats help you

    • mAxTeR December 31, 2012 at 9:57 pm - Reply

      there’s space between set%path should be like this set path=…. sorry

      • Phani chand July 25, 2014 at 2:55 pm - Reply

        seting path is simple…
        follow these instrucitons in ur command prompt…
        1. cd
        2. cd java
        3. cd jdk1.6.0_03
        4. set path=c:javajdk1.6.0_03bin
        5. cd bin

        to enter any file inside ur bin folder follow this..

        6. cd foldername
        ex: cd threads

    • admin January 2, 2013 at 4:49 pm - Reply

      Hi,

      Thanks for your response. I will update the article asap. Meanwhile before you compile source code check if path of javac is in the class path. To check it execute the command “javac” in command prompt.
      If response is
      ‘javac’ is not recognized as an internal or external command,operable program or batch file.

      It means path is not set currectly. To set the pat go to enviornment variable section of computer properties.From there set the path of javac.”C:Program FilesJavajdk1.7.0_10bin”.
      Note this will be permanent and you don’t need to do the same thing of setting path again and again.

      Thanks Max again for pointing this.

  6. bharat February 19, 2013 at 9:04 am - Reply

    hello sir .. i m not getting the bellow lines ..

    .

    • Ankur March 4, 2013 at 5:58 am - Reply

      Hi Bharat,

      #1 You have to set path as C:j2sdk1.5.0_04bin and class path as
      C:j2sdk1.5.0_04lib
      #2 Open cmd and hit this target “java -version”, it shows
      java version “1.6.0_17”
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
      Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
      #3 On cmd hit this target “javac”, it shows
      Usage: javac
      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
      ……………………………

      Now run the programme as per Above …………….
      Hope this is help you guys …………… 🙂

      • Jayapal December 11, 2013 at 6:42 pm - Reply

        working fine..

  7. Kamlesh March 5, 2013 at 10:12 am - Reply

    Hello Sir,
    I am a beginner of core java. Tutorials are helping me a lot. but can you tell me, Where can i have exercise for practice. How one can develop a logic in programming?
    Thanks..

    • admin March 6, 2013 at 5:16 am - Reply

      Hi Kamlesh,

      Soon i will upload the list of assignment that you can take help from and start developing the code.

      Thanks

  8. tan.rajesh May 1, 2013 at 2:16 am - Reply

    its amazing, i can’t how to learn easily. but now i am ready to easy learning way. Thank you sir. and thank you http://www.javabeginnerstutorial.com

  9. Mego July 16, 2013 at 9:38 am - Reply

    hey admin 🙂 its a rly cool site wanna know if this would help me to pass oracle jse 7? and anther thing if there any video tutorial ? to it thx alot 😀

  10. Praveen July 24, 2013 at 4:38 am - Reply

    can i develop java application in Linux environment ?????

    • admin July 24, 2013 at 5:02 am - Reply

      Yes, You can develop or run Java application in any major platform including Linux. You just need to download JDK specific for Linux. And you can start developing application. Click Here for different versions of JDK version for different platform.
      You can also download Eclipse for Linux from here

      Thanks

  11. Navateja August 5, 2013 at 3:41 am - Reply

    hey iam a beginner..i jus wanna learn from these ol tutorials..soo after writin a program n savin dat what should we do for compiling???i mean whatz d next step…???i immeditly writin d program i jus got to cmd n did what yu said but the error JBT cant be recognised by an internal or external command,z comin..so plz suggest me a solution admin…

    • admin August 6, 2013 at 5:37 pm - Reply

      Please check your mail and please let me know the exact problem you are facing.

      Thanks

  12. sunil soni August 6, 2013 at 1:24 pm - Reply

    You did not provide next button to read other article of this chapter………

    • admin August 6, 2013 at 5:36 pm - Reply

      I have taken it as suggestion and will try to provide the same if possible.

      Thanks

  13. Rajeev August 17, 2013 at 8:11 am - Reply

    Very well written……

  14. shashi kanth August 20, 2013 at 5:02 am - Reply

    Good site….

  15. masengesho September 10, 2013 at 2:22 pm - Reply

    it’s very interesting for us to give us knowledge

  16. Mandar September 16, 2013 at 2:09 pm - Reply

    Very well written and equally well organized articles!
    Thank you for sharing them with us.

  17. sireesha September 21, 2013 at 3:55 am - Reply

    Very helpful

  18. garg October 12, 2013 at 2:12 pm - Reply

    my javac not working when i run my program with javac it give statements javac is not recognized external &enternal then what should i do for compiling java program

    • admin October 13, 2013 at 3:12 am - Reply

      Hi Garg,

      It seems like JDK is not installed in your system. Please install the same and check if javac is working or not(JDK and not JRE). If you have already installed then check if path for bin is already added in environment variable or not.

      It should resolve your problem.

      Thanks

  19. Raja October 28, 2013 at 11:52 am - Reply

    Where is this article “difference between JDK and JRE”? I did not get this in this site.

  20. Ramesh Choutapelli October 30, 2013 at 5:55 am - Reply

    Thanks very much

  21. kalpana November 14, 2013 at 6:52 pm - Reply

    where i can see my jdk file.? in bin folder i seen jre file. when i can set the path it shows javac is not
    recoginsed as an internal or external command. whats the reason? please tell me

    • Vivekanand Gautam November 15, 2013 at 2:24 am - Reply

      Hi Kalpana,

      You must download and install JDK from Oracle website and not JRE. Once you install JDK folder instide JDK should be like below

      lib
      jre
      include
      db
      bin

      If everything is installed properly you should see javac executable(javac.exe) file in bin folder.
      If it is not therer then you have not installed JDK properly. If you confirm that JDK is installed properly then add path till bin to classpath /path in enviornment variable. Then only windows will be able to recognise this command.

      Thanks

  22. Abhishek anand November 22, 2013 at 12:28 pm - Reply

    sir,
    i installed java… but i am not able to run my programm…

    help me

  23. kumud November 29, 2013 at 2:42 pm - Reply

    kumud,
    i found error like ,Class names, “Example”, are accepted only if annotation processing is explicitly request
    please suggest me for this error

  24. sneha December 27, 2013 at 3:23 pm - Reply

    hello sir,

    my programm doesnt compile.i was install jdk properly.i also set path but still its give me an error like ‘javac’ is not recognize as an internal or external command,
    operable programm or batch file.
    pls give suggestion

    • Vivekanand Gautam December 28, 2013 at 7:29 pm - Reply

      Hi Sneha,

      Sorry for the late reply. As you can system is throwing an error of knowing command. In simple way you can say that your operating system(Windows) doesn’t know where this javac command(path).

      So to make OS understand you have to add path of javac in path in enviornment variable in My Computer.

      To know how to set path in windows you need to search on google or you can search article written by me.

      Hope this help.

      Thanks

      • sneha December 29, 2013 at 8:21 am - Reply

        thanks a lot sir its working now…

  25. Chalapathi January 3, 2014 at 5:50 pm - Reply

    Good Explanation for beginners as well as Experience…….
    Thanks a lot ………

  26. Babbu January 7, 2014 at 9:09 am - Reply

    Hi,

    when i type javac it gives me all the options properly and i cud see java -version also.after compiling i cud see a class file created in the folder.but when i type java FirstProgramme..it says ‘Could not find or load main class FirstProgramme..pls help me where im gng wrong

    • Vivekanand Gautam January 7, 2014 at 2:50 pm - Reply

      Hi babbu,

      There seems to be some problem with your source code. Java seems to be installed properly. Please share the source code i ll check and let you know what is the problem..

      Thanks

  27. Babbu January 8, 2014 at 11:46 am - Reply

    Hi,

    Below is the code i was trying,same as u have mentioned ..pls check
    public class FirstProgramme {
    public static void main(String args[]) {
    System.out.println(“Hello JBT”);
    }
    }

    • Vivekanand Gautam January 8, 2014 at 5:39 pm - Reply

      Hi Babbu,

      I don’t see any issue with given code. I am able to compile and run the application without any problem.

      I hope you have executed below command in sequence

      javac FirstProgramme.java
      java FirstProgramme

      I am able to execute the command without any problem and output get displayed properly.

      Thanks

  28. babbu January 10, 2014 at 6:04 am - Reply

    my bad..im still getting the same error ..not sure of the reason though 🙁

  29. Amriteya Pandey January 16, 2014 at 7:17 am - Reply

    The code is getting compiled but while running the .class file it is showing the following error.
    Please look into the matter.

    java.lang.ClassNotFoundException: FirstProgram
    java.net.URLClassLoader$1.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)

    • Vivekanand Gautam January 19, 2014 at 5:09 am - Reply

      Hi Amriteya,

      If class file is create properly and java is not working then it might be the case that current folder is not in path(Enviornment variable) of your OS.
      Please check all you path, classpath in enviornment variable. It should contain . as . represent current folder in windows OS.

      For your reference you can check my path entries.

      .;%M2%;%JAVA_h%;C:Program FilesJavajre7lib

      Here i have added . so it will compile and run wihout any problem.

      Thanks

  30. Kallanagouda Kittur February 7, 2014 at 8:38 am - Reply

    Thanks to Mr. Vivekanand Gautam.
    I truly appreciate your time and effort to make this Website.. It’s wonderful & easy to learn 🙂

  31. karthikkumar March 11, 2014 at 9:36 am - Reply

    it is so good for new java learners, I really like it.

  32. Aniket March 24, 2014 at 2:03 pm - Reply

    Next Chapter Button is still missing! 🙁

  33. sudheera March 27, 2014 at 6:32 am - Reply

    very good website ..:)

  34. deepu March 31, 2014 at 2:30 pm - Reply

    sir actually i dont have a supporting file of java bin

  35. m l pareek April 14, 2014 at 10:44 am - Reply

    Really u r a good heart having person,
    please keep continue..

  36. karishma April 15, 2014 at 4:37 pm - Reply

    i have downloaded JRE7 from the link mentioned above .So, i want to know whether i have to download JDK or nor.

  37. divya June 9, 2014 at 7:51 am - Reply

    i am very new to java,can u briefly explain about setting environmental variable

  38. pulkit June 14, 2014 at 7:01 pm - Reply

    sir do u have the simple notes of core java
    sir if u have , can u send me plz

  39. pulkit June 14, 2014 at 7:02 pm - Reply

    I am new to java… could you please send me the tutorial in pdf please….

  40. Annie June 22, 2014 at 3:30 pm - Reply

    hey getting the error could not find and load the main class
    what should i do?

  41. Amulya July 1, 2014 at 6:22 am - Reply

    Great blog which helped me a lot thanku

  42. Aditya July 3, 2014 at 6:41 am - Reply

    Hey Vivekanand,

    What is the best way to practice java, Eclipse or notepad?

  43. gayu July 3, 2014 at 8:06 am - Reply

    Hi,
    am begineer to this java. i have downloaded and installed the java s/w but i couldn’t find shortcut key to open and run the s/w. actually wats the problem with it? could you plz provide java programming tutorial?
    thank yu

  44. nilesh repale July 6, 2014 at 4:22 pm - Reply

    itz totally good..Thank you.. 🙂

  45. Ashu July 15, 2014 at 2:33 pm - Reply

    i have successfully installed java and i have checked it also in cmd… then i wrote the program in notepad and saved it as .java (and file name same as in the 1st line of programme). then in the next step again in cmd to change the file destination when i am writing the given codes, its says error “cant specify path file”.. plz help me out.

  46. richa July 29, 2014 at 2:23 am - Reply

    its aweome site….

  47. richa July 29, 2014 at 2:24 am - Reply

    its so helpfull site…

  48. richa July 29, 2014 at 2:45 am - Reply

    My teacher say make ur first love java … i think now its possible…this site is awesome to learn things in very deep..
    Thanku sir…

  49. kavi July 30, 2014 at 10:57 am - Reply

    hi
    u just stopped after clicking on the new button. what to after clicking on the new button, its showing two blanks areas what i have to enter

    • Vivekanand Gautam August 1, 2014 at 3:14 am - Reply

      Hi Kavi,

      I think you are talking about Environment variable settings. When you click on New button a window will be opened. In that window provide the environment variable name and value for the same.

      Example
      Variable Name : JAVA_HOME
      Variable Value : C:Program FilesJavajdk1.7.0_15

      Hope this helps

      Thanks

  50. sanjay August 3, 2014 at 6:21 am - Reply

    Dear sir

    Please help me.

    I have installed the java software as to told at above, its installed successfully but when I test it then it shows the problem(‘java’ is not recognized as an internal or external command,
    operable program or batch file.)

    Please help suggest me what should I do.

    • vinay December 21, 2015 at 5:51 pm - Reply

      You have to set the path variable for java..
      Right click on My Computer and select properties.
      Select advanced system settings.

      Click on environment variables tab.
      Now under user variables section , add a new variable with it’s path being the installation directory of java.

    • Steven grogan February 3, 2016 at 6:45 pm - Reply

      Try editing the Enviroment variables, make sure you include the semicolon before you write the path of where your JDK was installed, or it will not work. if you did install it in the same directory as the tutorial, your path should be:
      C:jdtbin

      and your path variable should look like (On the end of it):
      ;C:jdtbin

      if that doesn’t work, try making a folder in the jdt folder, that should work as long as you specify the directory.

    • Ajith February 4, 2016 at 12:51 pm - Reply

      Did you install the Java JDK and also check the version you have installed if the latest version is not supporting then try to install the lower version.

    • Narayana Reddy February 5, 2016 at 4:50 am - Reply

      first create path then u wil get

    • emmanuel February 6, 2016 at 12:21 pm - Reply

      Yes

  51. sanjay August 3, 2014 at 6:26 am - Reply

    Dear sir

    Please help me,

    I have installed the java two time as you instruct above but after successfully installed the software it shows the problem (‘java’ is not recognized as an internal or external command,
    operable program or batch file.)

    Please suggest me what should I do.

    • Raj December 21, 2015 at 4:44 pm - Reply

      Navigate to the correct path by entering cd then enter Java -version.

  52. Sujay August 7, 2014 at 1:10 pm - Reply

    Superb website !… 🙂

  53. marudhu August 11, 2014 at 11:45 am - Reply

    I know the java basic and im using netbeans , i want to learn run in core java means netbeans is enough or any other tool want to download ?

  54. sohail shaikh August 18, 2014 at 5:06 pm - Reply

    hiiii sir,

    Please help me i m the beginer and dont know anything about java plz send me the notes on my mail id..
    Thankyou.

  55. B.Sonika August 20, 2014 at 2:02 pm - Reply

    very good website…………..thank u so much……………

  56. Ramesh Raut Paul August 30, 2014 at 3:22 am - Reply

    This is good website to learn programming language …… thanks admin for supporting us to learn different programming language easily …..

  57. Manasa September 17, 2014 at 8:28 am - Reply

    Hi Admin,

    I followed your steps to install Java from the link provided. While setting the environment variables I saw that there are only bin and lib folders, there is no jdk folder. Please let me know why I might be facing this problem.

  58. Pavani October 11, 2014 at 8:07 am - Reply

    It is useful for beginners. . if possible please send notes to my mail. .

  59. Rahul October 27, 2014 at 7:45 am - Reply

    Hi Sir

    I am a php developer and trying to get the basic java understanding, I am using Eclipse and create the java application .but its very terrible it to run in eclipse.
    Please Give direction For Eclipse

    Thanks
    Rahul

  60. dark_lord October 31, 2014 at 4:58 am - Reply

    I think your page has the missing link. I couldnot find the page which contains the difference between JDK vs JRE …..

  61. Neeraja November 14, 2014 at 9:33 am - Reply

    Very Goog info. It is very Useful fore beginners. Thanking you.

  62. Harish November 21, 2014 at 11:26 am - Reply

    hey its awesome but am facing bit difficulty to give the path after saving the file.

    Plz can u help me on this?

  63. Elayaraja November 26, 2014 at 3:05 pm - Reply

    very good explanation
    hat’s up for ur efforts

  64. Poola Surendra November 26, 2014 at 3:51 pm - Reply

    Please tell i can’t understanding this kind of error, Program is ex cute but out put like this tell me Sir.

    C:UsersacerDocumants>javac FirstProgramme.java

    C:UsersacerDocumants>java FirstProgramme
    Error: Could not find or load main class FirstProgramme

    • Vivekanand Gautam December 2, 2014 at 5:05 pm - Reply

      Hi Poola,

      Sorry for late reply. Probably you have not used Public Access modifier with class name. Please check the same and update
      the class name accordingly and compile and run program again.

      • sanjay kr November 13, 2015 at 2:28 pm - Reply

        really nice concept

  65. Alec December 6, 2014 at 12:17 am - Reply

    Dear Vivekanand,

    Your site was recommended to us by out QA teacher in California. I love your site. Thank you for your time and hard work.

    Alec.

  66. Poola December 8, 2014 at 4:44 am - Reply

    Thank you Sir but now i worked different way i have use on-lee PATH Sir I’m not use CLASSPTH. this is cure-ct way. tell me Sir.

    • Madhavi December 15, 2015 at 11:29 am - Reply

      i think u have to set CLASSPATH variable.. and that should refer to your file’s class path

      ex : dir/Firstprogram.java ….. after compilation ….. dir/Firstprogram.class

      CLASSPATH -> C:/dir

  67. Radhika December 16, 2014 at 9:28 am - Reply

    very useful for all.

    What is Java Development Kit?

    • Vivekanand Gautam January 10, 2015 at 4:33 pm - Reply

      I am sry but i don’t have course material in PDF format.

  68. Swathi January 13, 2015 at 6:36 am - Reply

    Hi Sir,
    Very good work but you try to explain about each and every word and line sir.
    I mean like what is use of using the word PUBLIC,ARGS,[]…..
    everything then everyone would come to know the use of the words written in java program.

    Thanks

    • Vivekanand Gautam January 24, 2015 at 6:17 am - Reply

      Thanks

  69. Avi January 28, 2015 at 2:07 pm - Reply

    Vivek i want to know in which version of Eclipse we can run java programs????
    As like we run c programs in Turbo c.

    • Vivekanand Gautam January 31, 2015 at 1:52 pm - Reply

      Hi Avi,

      You just need to understand eclipse have different build release for different languages.

      There is no specific version just pick the java specific build and it will work for Java.

      http://www.eclipse.org/downloads/

      Here you can see different build to download. Select only java specific to download for different platform(Windows/ Unix)

      Hope it help.

      Regards
      Vivekanand Gautam

    • sabitha February 27, 2015 at 10:06 am - Reply

      sir,i want to go core java intw hw can i face it .tel me

  70. sathish February 18, 2015 at 9:21 am - Reply

    explain in encapsulation

  71. santosh kshirsagar March 11, 2015 at 4:19 am - Reply

    This is very good website..
    Sir, can you give me any idea about Asp.net Or Java is good for future..??

  72. saran March 26, 2015 at 9:33 am - Reply

    i have NEWLY installed JDK1.8.0 and netBeans 8.0.2version
    Problem:i have run below program getting run time error my coding below
    import java.sql.*;
    import java.io.*;

    public class jdbc
    {
    public static void main(String args[]) throws IOException
    {

    try {
    Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
    Connection con = DriverManager.getConnection(“jdbc:odbc:ba”);
    Statement select = con.createStatement();
    ResultSet result = select.executeQuery(“select * from test”);

    System.out.println(“Got results:”);
    while(result.next()) { // process results one row at a time
    String val = result.getString(2);
    System.out.println(“User_Id = ” + val);

    }
    select.close();
    con.close();
    }
    catch( Exception e ) {
    System.out.println(“connecting error”);
    e.printStackTrace();
    }
    }

    }

    set path:JAVA_HOME=C:Program FilesJavajdk1.8.0_40
    PATH=C:Program FilesJavajdk1.8.0_40bin;

    while running time error meg like below
    connecting error
    java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at jdbc.main(jdbc.java:10)

    please advise how run the above program please advise me

  73. Juned Khan March 30, 2015 at 4:38 am - Reply

    You are the Best MR.Authors. You work hard to help people.Thanks a lot for you Mr.Author and

    Gautam.You are the Best…….

  74. Ramusesan April 4, 2015 at 7:16 am - Reply

    hi sir i have planning to try for job with 1 yr exp in java , i have sound knowledge on j2se,j2ee,hiberate is it enough or want to learn anything pleas help me

    • Fata1Err0r October 2, 2015 at 3:51 pm - Reply

      When I was trying to get new job, I viewed online job postings and read the requirements to know exactly what I should know. It allowed me to research/learn the things that I didn’t know, and I was able to get the job. Hope that helps you!

  75. raamesh April 6, 2015 at 11:59 am - Reply

    sir,
    What are editors ,,,,, …… ????? I dont know anything about java ……..
    so please respond….

    • Fata1Err0r October 2, 2015 at 3:53 pm - Reply

      Editors (and IDE) are what you use to edit code, such as Eclipse.

  76. Anjana April 8, 2015 at 7:11 am - Reply

    I am new to JAVA. While executing the said script it is showing the below error. Wht should I do further
    C:Program FilesJavajdk1.7.0_71bin>javac C:UsersRekhaDesktopjava1.j
    C:UsersRekhaDesktopjava1.java:3: error: illegal character: 8220
    System.out.println(ôHello JBTö);
    ^
    C:UsersRekhaDesktopjava1.java:3: error: ‘;’ expected
    System.out.println(ôHello JBTö);
    ^
    C:UsersRekhaDesktopjava1.java:3: error: illegal character: 8221
    System.out.println(ôHello JBTö);
    ^
    C:UsersRekhaDesktopjava1.java:3: error: not a statement
    System.out.println(ôHello JBTö);
    ^
    4 errors

    • Fata1Err0r October 2, 2015 at 3:55 pm - Reply

      Change ôHello JBTö to “Hello JBT”

  77. samkit April 14, 2015 at 9:30 pm - Reply

    I want to know that i want to develop an android app for my business so from where should i start

  78. Nagalekshmi April 20, 2015 at 12:03 am - Reply

    Hi Anjana,
    Are you using ” .Is your statement same as System.out.println(“hello jbt”);

  79. Nagalekshmi April 20, 2015 at 12:07 am - Reply

    Check whether you have opened up { before your system.out statement.

  80. hema April 20, 2015 at 6:12 am - Reply

    really nice one for beginners,

  81. milaad May 18, 2015 at 10:17 am - Reply

    good..!!

  82. Sudeep May 21, 2015 at 2:17 pm - Reply

    it is a great websites for java beginners…

  83. Meghana May 22, 2015 at 3:45 pm - Reply

    Hi,

    I have installed java successfully and also defined the ClassPath and Path in the system variables settings as follows
    JAVA_HOME C:Program FilesJavajdk1.8.0_40
    CLASSPATH %JAVA_HOME%jrelib
    PATH %JAVA_HOME%bin

    while executing C:UsersUserDesktop>javac FirstProgramme.java
    C:UsersUserDesktop>java FirstProgramme
    Error: Could not find or load main class FirstProgramme

    Please help to fix this.

    Thanks.

    • V Gautam May 24, 2015 at 11:42 am - Reply

      Please check your mail

    • mat June 13, 2015 at 12:27 pm - Reply

      I had similar problem and after I removed CLASSPATH it started to work. Please give it a try.
      BR,
      Mat

    • Kundie Mhuruyengwe January 14, 2016 at 10:38 am - Reply

      @meghana

      Did you resolve your problem check your main block it should it should read :
      public static void main(){}

      not Main or its missing totally

  84. sagar June 4, 2015 at 7:17 pm - Reply

    can i start learning java core even if i dont know C language or any basic concepts of c
    like even loops or syntex or even 0.% knowledge of c
    CAN YOU RECOMMEND ME TO START JAVA CORE ?????
    ?????
    >>

    • V Gautam June 7, 2015 at 2:23 pm - Reply

      Please check your mail.

  85. aditya kulkarni June 14, 2015 at 10:12 am - Reply

    its really very nice to read it

  86. aaliya khan June 16, 2015 at 5:59 am - Reply

    nice

  87. nas June 17, 2015 at 11:27 am - Reply

    Good. Very simple and basic

  88. nas June 17, 2015 at 11:28 am - Reply

    Good. Very simple and basic. This is cool

  89. Pooja July 12, 2015 at 2:23 pm - Reply

    Sir, can u plz suggest me a bestest Java project which I can make and can make a great impact on everyone by showing that project

  90. Pooja July 13, 2015 at 5:17 pm - Reply

    Hloo srr can u plz suggest me a best java project which I can make

  91. karan July 29, 2015 at 11:23 am - Reply

    sir after the compilation it is written that javac is not recognised why sooooo????????

    • Rahul August 17, 2015 at 11:50 am - Reply

      When you change the environment variable with the JDK’s path. reload the command prompt and then type c:> javac -ver

      if you see the version of JDK. Then you are good to go

  92. Navya August 17, 2015 at 11:55 am - Reply

    hey..I have installed java using sudo apt-get install openjdk-7jdk. i am able to compile programs but not run any. if the program is error free it compiles successfully but when I try to run it, it says
    Exception in thread “main” java.lang.UnsupportedClassVersionError: client : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: client. Program will exit.
    please help me out as how i can solve this.

    • AMIT August 18, 2015 at 7:17 am - Reply

      why dont u try latest version or changing its directory path can also work

    • Ritesh December 1, 2015 at 4:17 pm - Reply

      Navya, you should java’s path in environment variable…
      Follow the following steps:
      Select Computer from the Start menu
      Choose System Properties from the context menu
      Click Advanced system settings > Advanced tab
      Click on Environment Variables, under System Variables, find PATH, and click on it.
      In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
      Reopen Command prompt window, and run your java code

  93. Tanvi August 26, 2015 at 10:15 pm - Reply

    Could you please share the method of setting classpath and java_home in mac?

  94. Prakash September 24, 2015 at 3:01 pm - Reply

    Thanks, awesome article..

  95. sharu January 6, 2016 at 12:37 am - Reply

    Can we learn java withlut any knowledge about c++ sir plz reply

    • J Singh January 9, 2016 at 6:08 pm - Reply

      There is no direct linking between C++ and Java. So yes you can learn java without knowing C++. Knowing C++ will help you in java, as some concepts are common but that will give you starting advantage but still you can learn java from scratch.

  96. Giri Babu January 11, 2016 at 3:10 pm - Reply

    Hello Sir/Madam,
    Actually i am planning to move another project, for that management team asked me to learn Core JAVA, so is it possible to learn at least basic concepts of CORE JAVA within ten days?????
    Please suggest me ASAP,
    Would you please reply me at your earliest convenience so that i can address your suggestions?

    Thanks in advance!!!
    Giri.

    • J Singh January 12, 2016 at 6:26 pm - Reply

      Hi Giri,

      There is no direct answer to this question. It all depends on where you are coming from. If you have learned C++ and then i might say you can learn a bit about Java. But in the end 10 is not enough to learn any language. But still in indian companies you don’t need to be rocket scientist to work on any project. So just start learning java soon you will learn enough to work.
      Best of luck for your new project.

      Regards

  97. Pranshu Kharkwal April 5, 2016 at 5:24 pm - Reply

    Hey ,
    Thank You for providing such awesome courses of core Java to students. You are doing a great work indeed.
    I got a suggestion for you.
    I have seen that there are a few untapped topics in this “Getting started with Java” tutorial , which I found are in the following article with the same topic.
    I would suggest you to add the matter here which will be beneficial for the students/readers.

    Thanks again you this awesome work. Hope you will take my words into consideration.

  98. Pranshu Kharkwal May 24, 2016 at 4:51 pm - Reply

    Truly and informative post.

  99. Yo June 3, 2016 at 3:35 pm - Reply

    Good initiative to help beginners! God bless! Its Truly Helpful>_<

  100. bindu June 10, 2016 at 4:48 am - Reply

    jbt means?

  101. sathish June 10, 2016 at 10:19 am - Reply

    its very helpful

  102. Harry June 17, 2016 at 7:45 am - Reply

    Nice article. Very helping

  103. kaush June 23, 2016 at 4:05 pm - Reply

    whats the meaning of each keyword in this line: public static void main(String args[])

  104. Amit June 25, 2016 at 3:35 am - Reply

    What is Package in java

    • J Singh July 6, 2016 at 11:26 am - Reply

      package is way of organizing java classes inside a project. You needs to have unique class name inside a package name. But class with same name can exist in different packages.

  105. Prashant July 18, 2016 at 7:16 pm - Reply

    Its awesome tutorial for any beginner ..

  106. Priyanka July 30, 2016 at 5:01 am - Reply

    Can extend this

  107. Komal August 1, 2016 at 11:28 am - Reply

    This tutorial is very helpful as I have just started learning ,I am getting things in correct manner ,and by following steps that are mentioned in the article, I’m getting things very easily and definitions are also very clearly understood.. 🙂

    Thanks & Regards,
    Komal

  108. Vivek August 18, 2016 at 11:37 am - Reply

    can i start learning java core even if i dont know C language or any basic concepts of c
    like even loops or syntex or even 0.% knowledge of c
    CAN YOU RECOMMEND ME TO START JAVA CORE ?????

  109. jyo August 20, 2016 at 5:06 am - Reply

    superb….i learn some basics from this article

  110. Prabhavathy. S September 13, 2016 at 3:03 am - Reply

    I am graduated in finance and know nothing about computer programming. But I am so interested in becoming a software engineer. Can you please tell me if learning java will help me for the same?

    • J Singh September 14, 2016 at 8:54 pm - Reply

      Hi Prabhavathy,

      I really don’t know the answer of this question. Just knowing java will not solve all your problem. But it will help you definitely. And learning java is not difficult unless you have good teacher.

      Regards

    • Srinivasa Tupurani September 23, 2016 at 12:20 pm - Reply

      I would like to share my real time experience here. I would say if you love programming go for it. Learning Java, gives you strong foundation for any IT professional line you desire. There are so many opportunities in IT like Business Analyst, Quality Assurance where one would expect to bring programming skills and Java is one among them. Within QA there are Automation programming tools like selenium. You can take this knowledge (Programming skills) and apply these skills in learning any other tool or building a Programming career (Entry level). Hope this helps!

  111. Srinivasa Tupurani September 23, 2016 at 12:50 pm - Reply

    I accidentally landed on your page while I am googling for Java Tutorial for my nephew.
    I have gone over this blog. The Tutorial was been built with very good thought process.. I would say If one spends their time, they certainly end up with strong foundation level in JAVA which I feel many of the IT professionals certainly need.

  112. Qlems September 23, 2016 at 4:52 pm - Reply

    Am a student of medicine who is trying to learn JAVA and belief you me , your tutorial is exceptional . I really love the systematic explanation.
    On point. We need people like YOU to help us understand software environment.

  113. Vij October 9, 2016 at 6:00 pm - Reply

    very nice topic..

  114. Kalai Duke November 2, 2016 at 11:39 am - Reply

    Really its very helpful or beginners. thank u soo much for providing this Tutorial..

  115. Colm November 11, 2016 at 10:19 am - Reply

    Thank You.

    Colm

  116. Bhavana February 8, 2017 at 12:00 pm - Reply

    Precise Explanation. Excellent!

  117. Annamalai T July 15, 2017 at 11:43 am - Reply

    Nice content

Leave A Comment