www.webdeveloper.com
Results 1 to 5 of 5

Thread: Compiling App problem! Need Help

  1. #1
    Join Date
    Aug 2011
    Posts
    4

    Lightbulb Compiling App problem! Need Help

    hi All,
    I've just start java have a problem with compiling an Application.
    First i done Coding :
    HTML Code:
    /* This program Will take two arguments Hello world from the command Prompt and prints them to standard console. If you specify less then two arguments an exception Will be thrown*/
    
    public class TwoArgsApp {
    
    public static void main(String args[]){
    
    //Displays the first argument on console
      System.out.println("First argument"+args[0]);
    
    //Displays the second argument on console
      System.out.println("Second argument"+args[1]);
     }
    }
    And when I've try to compile the App its don't print on console give the Eror you can see here :
    HTML Code:
    D:\>set path=C:\Program Files\Java\jdk1.6.0_27\bin
    
    D:\>javac TwoArgsApp.java
    
    D:\>java TwoArgsApp
    Exception in thread "main" java.lang.NoClassDefFoundError: TwoArgsApp
    Caused by: java.lang.ClassNotFoundException: TwoArgsApp
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: TwoArgsApp.  Program will exit.
    
    D:\>
    would you like to mention,where i was done mistake ?
    or is it jdk version problem ?

    Thanks in Advance
    usman

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,377
    Wrong forum.

    As described by another forum contributor:
    Java is to Javascript as Ham is to Hamster.

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    I have moved this Thread to the Java Forum

  4. #4
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    If you still haven't found solution, here are some suggesntions
    First: are you in the same folder where your newly created class TwoArgsApp.class file is?

    As compiler clearly can't find that class, and if you are then go through the sticky thread on top of this forum
    Troubleshooting guide for some basic.....
    It explains some very basic issues and how to resolve them for Java
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  5. #5
    Join Date
    Oct 2005
    Posts
    843
    Khalid Ali posted the best advice, did you end up getting it working us0343?
    Welsh

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles