Home Java Java-get-example Java error cannot read
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Java error cannot read

Advertisement
In this Tutorial we want to describe you a code that helps you in understanding a code ErrorcannotRead in java. For this we have a class ErrorcannotRead.In the main method we create an instance of class date.

Java error cannot read

     

The Java error cannot read occurred when a programmer do not follow the following condition-

  1. Putting files in the bin directory  where the javac resides.
  2. The default home drive is C:\ go to cd\
  3. A programmer can make your personal room directory mkdir javaroom.
  4. Put your example with java  extension file to my javaroom.
  5. Add a line to your autoexec.bat and reboot the machine.

    SET CLASS PATH=.;C:\javaroom;%CLASSPATH%
     
    (This means current directory )
    ('%CLASS PATH%' means  existing CLASS PATH definition.)
     
  6. Go to javaroom directory
     
     cd javaroom
      
  7. 7)Javac MyFirstProgram.java
      
     Java  MyFirstProgram.

Understand with Example

In this Tutorial we want to describe you a code that helps you in understanding a code ErrorcannotRead in java. For this we have a class ErrorcannotRead.In the main method we create an instance of class date. The System.out.print ln is used to print the year by calling a method .get Year ( ).On execution the code show you an error Java Error cannot made Symbol. This error occurred because the programmer write the wrong class name on the command prompt. Therefore the compiler does not reconogised the class name and show you an error ErrorcannotRead.java.

ErrorcannotRead.java

import java.util.*;

public class ErrorcannotRead {

  public static void  main(String[] args
  {
  Date d=new Date();
  System.out.println(d.getYear());

  }
  }

Output


To resolve this error you have to give the proper file name of the java file.Here in the example our java file name is ErrorcannotRead.java and we are compiling file as ErrorcannotRead1.java

Download code
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 4, 2008

Related Tutorials

Ask Questions?    Discuss: Java error cannot read   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
ANIJA V.S
March 16, 2012
aakash2

i like it
DMCA.com