473,238 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

error when trying to run the program

50
when i am trying trying to run the program, a windows pops up with the following message:

"selection does not contain a main type"

I think that the problem is with the directories and workspace.. I dont know how to rearrange my directories.. I cannot even run any program..

Please help...

thankyou very much

christine
Sep 21 '07 #1
15 8723
r035198x
13,262 8TB
when i am trying trying to run the program, a windows pops up with the following message:

"selection does not contain a main type"

I think that the problem is with the directories and workspace.. I dont know how to rearrange my directories.. I cannot even run any program..

Please help...

thankyou very much

christine
Post the code using code tags.
Sep 21 '07 #2
Nepomuk
3,112 Expert 2GB
when i am trying trying to run the program, a windows pops up with the following message:

"selection does not contain a main type"

I think that the problem is with the directories and workspace.. I dont know how to rearrange my directories.. I cannot even run any program..

Please help...

thankyou very much

christine
What does your program look like and how are you trying to run it? If you think it's with the directories, what do they look like?

Greetings,
Nepomuk
Sep 21 '07 #3
sugard
50
i am not very familiar in using Eclipse since before I used to program with a textpad. What do I need to do exactly please?
Sep 21 '07 #4
Nepomuk
3,112 Expert 2GB
i am not very familiar in using Eclipse since before I used to program with a textpad. What do I need to do exactly please?
If you're using Eclipse, the paths shouldn't be a problem normally, as Eclipse does that automaticly.

Please post your code (or at least the class definition and main method) using CODE tags and just to make sure, tell us, what the "package explorer" (left side of Eclipse) shows.

Oh, how did you try to run it? The correct way is, to left click on the Class with your main method, choose "Run As" -> "Java Application".

Greetings,
Nepomuk
Sep 21 '07 #5
sugard
50
what are CODE tags?
When I am trying to run the program the previous name of the class that I used in that workspace is being displayed. When I edit to the correct class, still the same error came by.

QUOTE=nepomuk]If you're using Eclipse, the paths shouldn't be a problem normally, as Eclipse does that automaticly.

Please post your code (or at least the class definition and main method) using CODE tags and just to make sure, tell us, what the "package explorer" (left side of Eclipse) shows.

Oh, how did you try to run it? The correct way is, to left click on the Class with your main method, choose "Run As" -> "Java Application".

Greetings,
Nepomuk[/quote]
Sep 21 '07 #6
JosAH
11,448 Expert 8TB
when i am trying trying to run the program, a windows pops up with the following message:

"selection does not contain a main type"

I think that the problem is with the directories and workspace.. I dont know how to rearrange my directories.. I cannot even run any program..

Please help...

thankyou very much

christine
You don't need to rearrange directories; Eclipse does that for you. Simply create
a project and add your .java files to it. Next select 'Run ...', create a new launcher,
select your project and the class that contains a main method. Press 'Accept'
and 'Run'.

kind regards,

Jos
Sep 21 '07 #7
sugard
50
I have this code which is not finished yet and it is not a launcher

Expand|Select|Wrap|Line Numbers
  1. public class Matrix {
  2.  
  3. /*    public static int[] randomIntArray(int length, int n)
  4.     {
  5.         int[] a = new int[length];
  6.         Random generator = new Random();
  7.         // for each item in the list
  8.         (for int i = 0; i < a.length; i++) {
  9.             // create a new random number
  10.             a[i] = generate.nextInt(n);
  11.         }
  12.     }*/
  13.  
  14.     // the dimensions for the matrix
  15.  
  16.     // Matrix dimensions
  17.     int nRowsMatrixA = 2;  //  number of rows for matrix A
  18.     int nColsMatrixA = 3;  //  number of columns for matrix A
  19.     int nRowsMatrixB = 3;  //  number of rows for matrix B
  20.     int nColsMatrixB = 2;  //  number of columns for matrix B
  21.     int nRowsMatrixC = 2;  //  number of rows for matrix C
  22.     int nColsMatrixC = 2;  //  number of columns for matrix C
  23.  
  24.     double [][] matrixA = new double [nRowsMatrixA][nColsMatrixA];
  25.     double [][] matrixB = new double [nRowsMatrixA][nColsMatrixB];
  26.     double [][] matrixC = new double [nRowsMatrixC][nRowsMatrixC];
  27.  
  28.     Random rand = new Random();
  29.     matrixA [0][0] = rand.nextInt(20);
  30.  
  31.  
  32.     public Matrix multiply (Matrix multiplicand, Matrix multiplier) {
  33.  
  34.  
  35.  
  36. }
  37. }
I am trying to build 2 matrices which when multiplied another matrix with the answer will be displayed. So I cannot compile the program?
Sep 21 '07 #8
JosAH
11,448 Expert 8TB
So I cannot compile the program?
Sure you can; as I wrote: create a project in Eclipse; add a file Matrix.java to it;
add the content (see above) to that file and press ctrl-shift-s. You can't run that
class (yet) because it doesn't have a public static void main(String[] args) method yet.

kind regards,

Jos
Sep 21 '07 #9
Nepomuk
3,112 Expert 2GB
I have this code which is not finished yet and it is not a launcher
Expand|Select|Wrap|Line Numbers
  1. public class Matrix {
  2.  
  3. /*    public static int[] randomIntArray(int length, int n)
  4.     {
  5.         int[] a = new int[length];
  6.         Random generator = new Random();
  7.         // for each item in the list
  8.         (for int i = 0; i < a.length; i++) {
  9.             // create a new random number
  10.             a[i] = generate.nextInt(n);
  11.         }
  12.     }*/
  13.  
  14.     // the dimensions for the matrix
  15.  
  16.     // Matrix dimensions
  17.     int nRowsMatrixA = 2;  //  number of rows for matrix A
  18.     int nColsMatrixA = 3;  //  number of columns for matrix A
  19.     int nRowsMatrixB = 3;  //  number of rows for matrix B
  20.     int nColsMatrixB = 2;  //  number of columns for matrix B
  21.     int nRowsMatrixC = 2;  //  number of rows for matrix C
  22.     int nColsMatrixC = 2;  //  number of columns for matrix C
  23.  
  24.     double [][] matrixA = new double [nRowsMatrixA][nColsMatrixA];
  25.     double [][] matrixB = new double [nRowsMatrixA][nColsMatrixB];
  26.     double [][] matrixC = new double [nRowsMatrixC][nRowsMatrixC];
  27.  
  28.     Random rand = new Random();
  29.     matrixA [0][0] = rand.nextInt(20);
  30.  
  31.  
  32.     public Matrix multiply (Matrix multiplicand, Matrix multiplier) {
  33.     }
  34. }
  35.  
I am trying to build 2 matrices which when multiplied another matrix with the answer will be displayed. So I cannot compile the program?
That class doesn't have a main method, does it? Of course you can't run it then!

If you just want to compile, don't worry - Eclipse is normally set to do that automatically. If it doesn't, check the following:
  • In the task bar, choose "Project"
  • Enable "Build Automatically"
Or just left click on your Project and choose "Build Project".

Greetings,
Nepomuk

PS.: CODE tags are what I used in your quote to make the code look so nice. Just choose the # symbol in the editor when posting your code.
Sep 21 '07 #10
sugard
50
still it didnt work.. dw... i got a big mess where the projects are saved.. dw
Sep 21 '07 #11
Nepomuk
3,112 Expert 2GB
still it didnt work.. dw... i got a big mess where the projects are saved.. dw
What didn't work?
Sep 21 '07 #12
sugard
50
the same window is still popping up with the same error message.
Sep 21 '07 #13
Nepomuk
3,112 Expert 2GB
the same window is still popping up with the same error message.
Do you have a main method now?
Sep 21 '07 #14
JosAH
11,448 Expert 8TB
I'm a bit sick and tired of all those exclamation marks and all that 'urgent' stuff.
I adjusted the topic title.

kind regards,

Jos
Sep 21 '07 #15
Hi,

I was having the same problem with a new install of Eclipse on Ubuntu 7.10 beta.

I was getting an out of memory error as well, and when I didn't get an out of memory error I would get the error the OP was. It stopped after I started running eclipse with these arguments:

Expand|Select|Wrap|Line Numbers
  1. -vmargs -Xmx512m
  2.  
Oct 8 '07 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
2
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
0
by: Benny | last post by:
I have been trying to instal AutoCAD 2008 on a single PC and get the following Microsoft .NET Framework security error. I have updated to the latest .NET Framework 2.0 software, however, this...
2
by: techgirl | last post by:
Hi All- I was wondering if anyone could help me with this issue. I am trying to run this 3rd party application called "CoreFTP.exe" from within C#. I have tested my code with "Notepad.exe" and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.