Hi,


On 20 Feb., 09:52, Jegan S <[email protected]> wrote:
> Deat friends,
>
> I tried the following program. when I was going to run this its show the
> following errors,
> pls help to run this program.
>
> program:
>
> import java.util.Stack;
> public class StackExample {
>   public static void main(String args[]) {
>     Stack s = new Stack();
>     s.push("Java");
>     s.push("Forums");
>     s.push("and");
>
>     System.out.println("Next: " + s.peek());
>     s.push("Tips");
>     System.out.println(s.pop());
>     s.push(".");
>     int count = s.search("Java");
>     while (count != -1 && count > 1) {
>       s.pop();
>       count--;
>     }
>     System.out.println(s.pop());
>     System.out.println(s.empty());
>   }
>
> }
>
> output:
>
> D:\SJ>javac StackExample.java
> Note: StackExample.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
>
> D:\SJ>java StackExample
> Exception in thread "main" java.lang.NoClassDefFoundError: StackExample


Try setting the classpath to the current directory

D:\SJ>java -cp . StackExample

HTH
Ewald

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to