How to compile packages in java?
<p>I have written a simple package program:</p>

<hr>

<pre><code>  //A simple package

       package MyPack


       class Balance
       {
        String name;
        double bal;

        Balance(String n, double b)
        {
            name=n;
                    bal=b;
            }

        void show()
            {
            if(bal&lt;0)
            System.out.println("--&gt;");
            System.out.println(name+ ": $:" +bal);
        }
        }

        class AccountBalance
        {
            public static void main(String args[])
            {
                       Balance current[]=new Balance[3];
                    current[0]=new Balance("A.K.Juwatkar",123.123);
                    current[1]=new Balance("A.P.Dhoke",345.67);
                    current[2]=new Balance("Anil Sarang",100.98);

                    for(int i=0;i&lt;3;i++)
                current[i].show();
               }
        }
</code></pre>

<hr>

<p>I am using Ubuntu 10.04 &amp;
When i compile it using</p>

<pre><code>java MyPack.AccountBalance
</code></pre>

<p>I get the following message:</p>

<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: MyPack/AccountBalance
Caused by: java.lang.ClassNotFoundException: MyPack.AccountBalance
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: MyPack.AccountBalance. Program will exit.
</code></pre>

<p>What is wrong? Please help me out.
I have installed openjdk, do i need to install anything else??
I am using Ubuntu 10.04, kindly help me out</p>
