Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: no error when compiled but when the program runs .. help this !!!

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default no error when compiled but when the program runs .. help this !!!

    hellow gud morning!!!
    i apologizes for asking simple and silly question like this... but i am a beginner to java programming and is trying to learn it..

    WHEN I COMPILE THE PROGRAM BELOW IT'S CORRECT AND THERE'S NO ERROR BUT WHEN I RUN THE PROGRAM AN ERROR COMES AND I DON'T KNOW HOW TO SOLVE IT..
     
     
     
     
     
     
        public class small{
     
     
     
        //This method returns the index of the smallest value in the array of given size
     
        public static void smallestIndex (int[] array) {
     
        int currentValue = array[0];
        int smallestIndex = 0;
     
        for (int j=1; j < array.length; j++) {
        if (array[j] < currentValue)
        currentValue = array[j];
        }
     
        System.out.println();
        System.out.println("The smallest index is: "+ currentValue);
     
        }
     
      }




    I GET THESE ERROR ;


    ---------------------------------------------------------------------------------------

    --------------------Configuration: neew - JDK version 1.6.0_27 <Default> - <Default>--------------------
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)

    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
    show splash screen with specified image

    Process completed.
    -------------------------------------------------------------------------------------


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,514
    My Mood
    Grumpy
    Thanks
    0
    Thanked 165 Times in 156 Posts

    Default Re: no error when compiled but when the program runs .. help this !!!

    Obviously you use the incorrect command to run your program. The error message provides the correct usage.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: no error when compiled but when the program runs .. help this !!!

    so correct it for me .. hoW?????

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,514
    My Mood
    Grumpy
    Thanks
    0
    Thanked 165 Times in 156 Posts

    Default Re: no error when compiled but when the program runs .. help this !!!

    I have only seen 2 of your threads and in each one you basically demand that people spoonfeed you solutions rather trying to solve the problem yourself. I'm sure there are plenty of resources on the net which provide information about compiling and running Java programs. Oracles tutorials definately have the info you need.
    Improving the world one idiot at a time!

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: no error when compiled but when the program runs .. help this !!!

    anyway thank you for your information.... i will try then

  6. #6
    Junior Member
    Join Date
    Oct 2011
    Posts
    10
    My Mood
    Cheerful
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: no error when compiled but when the program runs .. help this !!!

    Some times its problem of jre.re install jre and try...

Similar Threads

  1. Java Program that Runs in Background
    By 1bun100 in forum Java Theory & Questions
    Replies: 7
    Last Post: September 15th, 2011, 02:10 PM
  2. Program Runs in Eclipse but Not When Exported
    By Pantheon8 in forum Java IDEs
    Replies: 2
    Last Post: August 17th, 2011, 05:57 PM
  3. [SOLVED] Compiled .jar won't work (Error-sound)
    By Fermen in forum Object Oriented Programming
    Replies: 2
    Last Post: March 31st, 2011, 05:24 PM
  4. Blackjack program runs excrutiatingly slow.
    By sina12345 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 10th, 2010, 03:55 AM
  5. Program compiled/ran as required - FAILED project WHY??????????
    By MISSAJ in forum What's Wrong With My Code?
    Replies: 7
    Last Post: June 23rd, 2010, 03:35 PM