Example : How to check whether java is properly installed/functioning in a system or not.

----------  JAVA CORRECT INSTALLATION CONFIRMATION  ------------

Open DOS - stay at C-prompt - Type 'javac' - Press Enter - Java Compiler details message appear on the screen - It means that Java is properly installed.

C:\Users\RAJESH>cd\
C:\>javac (Press Enter)

javac messages are -
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
.
.
.
.
----------  JAVA INCORRECT INSTALLATION CONFIRMATION  ------------

Open DOS - stay at C-prompt - Type 'javac' - Press Enter 

C:\Users\RAJESH>cd\
C:\>javac (Press Enter)
'javac' is not recognized as an internal or external command,operable program or batch file.

C:\>

NB : To correct the java installation, Set the path correctly after installation.

Example : How to set path in java for proper functioning of java program.

Open java bin folder (for jdk) from Program Files in C drive of the System - Copy its path by clicking in address bar area - Now, Right click on 'This PC' icon on desktop - Click 'Properties' - Click 'Advanced System Settings' - Click 'Advanced' Tab - Click on 'Environment Variables' - In System Variables' section choose/select 'Path' option from 'Variable' list - click on 'Edit' option - click on 'New' button - Type the copied path of jdk(C:\Program Files\Java\jdk1.8.0_102) - Ok - Ok - Ok.

Example : How to remove “Error: Could not find or load main class XXX…” in java arise  during                      interpretation.

Error Arise Format :

E:\NewFolder1>javac Example1.java

E:\NewFolder1>java Example1   //classname
Error: Could not find or load main class Message
----------------------------------
Solution 1:

Write this command at DOS Prompt (C:\>) - 
"C:\>set classpath=%classpath%;." (Now check/run your java program)
----------------------------------
Solution 2:

Uninstall java from a system completely and re-install once again and set its path properly. (Now check/run your java program)

----------------------------------
Solution 3:

Open java bin folder (for jdk and jre) from Program Files in C drive of the System - Copy its path by clicking in address bar area - Now, Right click on 'This PC' icon on desktop - Click 'Properties' - Click 'Advanced System Settings' - Click 'Advanced' Tab - Click on 'Environment Variables' - click 'New' button in 'User Variables (if not successful, then do same for System Variables') section - Type 'CLASSPATH' in 'Variable name' box - Now, Paste copied path for jdk/jre or both (C:\Program Files\Java\jdk1.8.0_102 ; C:\Program Files\Java\jre1.8.0_102 )one by one separated by ; symbol in 'Variable Value' box - Ok - Ok - Ok.

 356 total views,  2 views today


0 Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.