Reputation: 105
I have created a Java package, Matrix. When I attempt to run it, I get the error "Selection does not contain a main type". But, as the code that I've copied and pasted from the class DriverMatrix shows, there is a main method declaration. I have attempted to restart Eclipse and I still get the error. I created the package called Matrix, then imported .java files for each class. Anyone know what's going on here? Here is the main declaration along with just a bit of code:
package Matrix;
import java.io.*;
import java.util.Scanner;
public class DriverMatrix
{
static private IntegerArithmetics integerArithmetics = new IntegerArithmetics();
static private DoubleArithmetics doubleArithmetics = new DoubleArithmetics();
public static void main(String[] args) throws FileNotFoundException
{
Scanner inFile = new Scanner (new FileReader("in.txt"));
PrintWriter outFile = new PrintWriter("out.txt");
Matrix<Integer,IntegerArithmetics> matrix1 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,3);
Matrix<Integer,IntegerArithmetics> matrix2 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,3);
Matrix<Integer,IntegerArithmetics> matrix3 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,3);
Matrix<Integer,IntegerArithmetics> matrix4 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,3);
Matrix<Integer,IntegerArithmetics> matrix5 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,3,2);
Matrix<Integer,IntegerArithmetics> matrix6 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,2);
Upvotes: 0
Views: 587
Reputation: 257
According to your code
Matrix<Integer,IntegerArithmetics> matrix1 = new Matrix<Integer,IntegerArithmetics>(integerArithmetics,2,3);
it seems that you have a package and class with both entitled as Matrix. Try to change this first as naming conflict will obviously cause error.
Source: Naming a package
Upvotes: 1
Reputation: 68715
There seems to be a Matrix
class and package name conflict in your project and it may be leading to eclipse error. Try renaming one of those and then run your application.
Upvotes: 2