COMMON PROBLEMS AND THEIR SOLUTIONS


COMMON ERROR MESSAGES ON MICROSOFT WINDOWS SYSTEM

FLOW OF THE PROGRAM DURING COMPILATION AND EXECUTION :

PROGRAM FLOW

JAVA IS PLATFORM INDEPENDENT :

JAVA PLATFORM INDEPENDENT

COMPILER PROBLEMS : 

1. ‘Javac’ is not recognised as an internal or external command, operable program or batch file.

If you receive this error , windows cannot find the compiler ( that is Javac)

so , you should tell the windows to find the compiler(Javac) by setting up the path.

suppose you installed the jdk setup file in  c-drive , then , set the path in command prompt as

c:\program files\Java\jdk1.6.0\bin;.; and press enter. now the windows will know where the compiler ( Javac ) is. 

To ensure the path , which you have set correct or not ,  then type in the command prompt as 

echo %path% and press enter then it will show you the path you have given to the windows.

RUNTIME PROBLEMS :

CLASSPATH : If you receive this error ,

Exception in thread “main” java.lang.NoClassDefFoundError: HelloWorldApp(example program )

 consider, that you have written a Java code and saved it in a  ‘d’ drive in Java programs then you have  to set the classpath for your program execution in command prompt .

  • you need not be set the classpath if you were in the same drive and in the same folder where your’e .class file is present .
  •  if not , you were in another drive in command prompt then you should set  the classpath for the program execution 

To do so, you have to tell the windows where the .class file is by setting up the classpath  ( if you were in another dirve ) 

    example:

   set classpath=d:\Javaprograms;.; press enter

To ensure the classpath then type 

 echo %classpath% press enter

NOTE: To compile a program path setting is required and to run a program classpath setting is required . So to avoid this extra typing each time when you compile or run a program , set path permanently by the following way.

PERMANENT PATH SETTING :

Updating the PATH Environment Variable (Optional)

You can run the JDK without setting the PATH environment variable, or you can optionally set it so that you can conveniently run the JDK executable files (javac.exe, java.exe, javadoc.exe, and so forth) from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:\> “C:\Program Files\Java\jdk1.7.0\bin\javac” MyClass.java

It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:

C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin

5 responses

  1. this is a really good read for me. must agree that you are one of the coolest blogger i ever saw. thanks for posting this useful information. lista de email lista de email lista de email lista de email lista de email

  2. thanks for taking the time to write, i never find time to write good posts. i really appreciate all the good information everyone has to share. lista de emails lista de emails lista de emails lista de emails lista de emails

  3. thank you . sure i will proceed with a good stuff

  4. i really liked the topics you post here. thanks for sharing this information that is so helpful for us. good day. lista de email lista de email lista de email lista de email lista de email

    1. it’s my pleasure to share the information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: