java.lang.NoSuchMethodError: main

OK I ve googled it and it didnt help that much..

I ve this piece of code

public static void main(String DataType, double CurrentValue,double PreviousValue, String ID) throws FileNotFoundException {
//testing testing
double[] Measurements;
Measurements[0]=20.0;
Measurements[1]=35.0;
ID="JohnDoe232";


+ bla bla bla...

I tried also putting the data before the main declaration and still the same problem.
I understand this has maybe something to do with the "static"??
But, how do I resolve it?
(damn beginner's luck)


Comments

  • Ok, found the thing alone guys...

    Only string[] allowed, so I have to check some double.parsedouble() method.. correct?
  • Yes basically, find the string that you want to change into a double and use
    [code]Double.parseDouble("Put your string here");[/code]
    You can also use Integer.parseInt() for ints!
    -------------------------------------------------
    Want to get started on java? Head on over to ma site!!!!!
    http://learnyojava.blogspot.com/
  • hi,
    First thing u need to understand is, in java the syntax for main function is- public static void main(String args[])
    {

    }
    It is hardcoded in JVM. JVM starts execution from main method only.So you must write it as it is. if u change something in that syntax, then JVM will treat it as normal method and expects a main method to start execution.

    So u change ur code by adding main method.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories