coolskater49
Technical User
hiya,
im writing a pretty simple application in Java using JBuilder 9.
i have 2 .java files in my project, one of which holds a class containing methods i have defined myself, the other holds a class containing a main() method. Within the main() method the user is prompted to enter data, and actions are performed on this data using the methods in the other class.
example of class containing methods:-
public class MyMaths
{
public static int sum(int a, int b)
{
return (a + b);
}
example of class containing main() method:-
import corejava.*;
import MyMaths.*;
public class SimpleMaths
{
public static void main(String args[])
{
When i come to run this project i get the error -
"SimpleMaths.java": package MyMaths does not exist at line 2, column 1
If i then remove the line 'import MyMaths.*;' i get no compiler errors but when i run, a Java Virtual Machine Launcher dialog box appears saying 'Could not find main method. Program will exit!'
the following message is also displayed 'java.lang.NoSuchMethodError: main'
Can anyone please help?
this is probably something simple i have missed out but i cant see anything wrong
thanks in advance
Paul.
im writing a pretty simple application in Java using JBuilder 9.
i have 2 .java files in my project, one of which holds a class containing methods i have defined myself, the other holds a class containing a main() method. Within the main() method the user is prompted to enter data, and actions are performed on this data using the methods in the other class.
example of class containing methods:-
public class MyMaths
{
public static int sum(int a, int b)
{
return (a + b);
}
example of class containing main() method:-
import corejava.*;
import MyMaths.*;
public class SimpleMaths
{
public static void main(String args[])
{
When i come to run this project i get the error -
"SimpleMaths.java": package MyMaths does not exist at line 2, column 1
If i then remove the line 'import MyMaths.*;' i get no compiler errors but when i run, a Java Virtual Machine Launcher dialog box appears saying 'Could not find main method. Program will exit!'
the following message is also displayed 'java.lang.NoSuchMethodError: main'
Can anyone please help?
this is probably something simple i have missed out but i cant see anything wrong
thanks in advance
Paul.