package ConsoleApplicationsSamples; import java.io.InputStreamReader; import java.io.IOException; /** * Simple program that accepts a character (letter or number) and * display its location in ASCII code using .read() method of * InputStreamReader class in java.io package. * * */ public class ASCIIDisplay { private static InputStreamReader isr = new InputStreamReader(System.in); public static void main(String[] args) throws IOException { int keyIn; System.out.print("Enter The Character That You Want To Locate In ASCII: "); keyIn = isr.read(); System.out.println(keyIn); } }
after a month that i saved this file .. i run it a while ago...
and this is the output
run: java.lang.NoClassDefFoundError: xTestsx/ASCIIDisplay Caused by: java.lang.ClassNotFoundException: xTestsx.ASCIIDisplay at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: xTestsx.ASCIIDisplay. Program will exit. Exception in thread "main" Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)
and when i changed the package to where it belongs andi edit the code by typing anything in the environment ("asdjashdkjahdkajsdhkasd") and 'UNDO' it
it compiled perfectly....
and i revert it back from the package where it belongs,compiled it,
there's an error again.... 'ClassNotFoundException' so i type lots of letters again then UNDO it , and it compiled again perfectly .
whats going on?
i tried to clean it up... same thing happens.. same solution