[Eclipse Problem] Selection does not contain a main type?
well i am using a GUI builder software which generates java code, i made a simple one to test and it will not compile.
import java.awt.*;
import javax.swing.*;
public class name {
@SuppressWarnings("unused")
private void initComponents() {
panel1 = new JPanel();
label1 = new JLabel();
textField1 = new JTextField();
panel1.setLayout(new FlowLayout());
label1.setText("Name:");
label1.setHorizontalAlignment(SwingConstants.LEFT);
panel1.add(label1);
textField1.setColumns(12);
textField1.setText("hi");
panel1.add(textField1);
private JPanel panel1;
private JLabel label1;
private JTextField textField1;
}it should make a basic swing GUI but it just gives me the error "Selection does not contain a main type"
I did not select in eclipse "use public static void main" i know im not supposed to because this has no main method, but how am i to compile this? =X
Edited by: -Johnny- on May 14, 2008 6:44 PM
Edited by: -Johnny- on May 14, 2008 6:44 PM
-Johnny- wrote:
ya i used javac instead of eclipse then running it complains like you say
but is there any way to compile this code and it will work? I was hoping to use this GUI builder for business purposes but it seems like a waste of money so far if i can't make working java application with it =\The code is fine. You need to learn the basics. Start with the intro tutorials at the Sun type and start reading and coding.
Here is what the rest could look like:
import java.awt.*;
import javax.swing.*;
public class name
@SuppressWarnings("unused")
private void initComponents()
panel1 = new JPanel();
label1 = new JLabel();
textField1 = new JTextField();
panel1.setLayout(new FlowLayout());
label1.setText("Name:");
label1.setHorizontalAlignment(SwingConstants.LEFT);
panel1.add(label1);
textField1.setColumns(12);
textField1.setText("hi");
panel1.add(textField1);
private JPanel panel1;
private JLabel label1;
private JTextField textField1;
public name()
initComponents();
public JPanel getPanel()
return panel1;
private static void createAndShowUI()
JFrame frame = new JFrame("name");
frame.getContentPane().add(new name().getPanel());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
public static void main(String[] args)
java.awt.EventQueue.invokeLater(new Runnable()
public void run()
createAndShowUI();
}Edited by: Encephalopathic on May 14, 2008 7:10 PM
Similar Messages
-
Eclipse problem selection does not contain main type
i m using eclipse3.3 and have set all the necessary paths in it
but when i run a simple java program just for displaying hello world but
the error comes
selection does not contain main typeYou must have a class with a main method.
The main method must be public, must be static, must return void, must have parameter String [], and is case sensitive (so does Java).
Put this into your class
public static void main(String args[]) {
}Let me know if it answers your question.
Best regards. -
Help - Editor does not contain a main type error (Eclipse)
Hello,
I'm trying to run a Text input program out of the Eclipse program and I keep getting this Editor does not contain a main type error - can someone help me
here's the code
import java.io.File;
import java.io.FileNotFoundException;
import java.text.DecimalFormat;
import java.util.Scanner;
import uwcse.io.Input;
public class FileInputExample {
public static void main(String[] args) {
// Create a Scanner to read the input file
String fileName = new Input().readString("Input file name? ");
System.out.println();
Scanner scan;
try {
scan = new Scanner(new File(fileName));
} catch (FileNotFoundException e) {
System.out.println(fileName + " doesn't exist!");
return;
// Read the file and count the number of occurences of A, B, ...
int[] count = new int[26];
while (scan.hasNextLine()) {
String line = scan.nextLine();
line = line.toLowerCase();
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
if (c >= 'a' && c <= 'z') {
count[c - 'a']++;
scan.close();
int length = 0;
for (int i = 0; i < count.length; i++) {
length += count;
// Display the statistics (as an histogram)
DecimalFormat df = new DecimalFormat("0.00");
for (int i = 0; i < count.length && length > 0; i++) {
double percent = count[i] * 100.0 / length;
String display = "" + (char) ('a' + i);
display += "(" + df.format(percent) + "%):\t";
for (int j = 1; j <= Math.round(percent); j++) {
display += "X";
System.out.println(display);
}ThanksFirst, note that your program uses a non-standard class, "uwcse.io.Input" which is not available to us. Normally that is a show stopper - in this case, it's not, as I was able to eliminate its use.
Your program runs fine, so the error is an Eclipse error unrelated to Java.
You need to ask for help at an Eclipse support site, not here, as these forums are Java language forums. -
Eclipse "selection does not contain main type" - but it does contain a main
Hi!
I'm having a strange thing happen to me when using the eclipse IDE in a macintosh envirnment.
I imported a project, complete with package, and all of my classes. and when I try to run my main class, it tells me "selection does not contain main type".
Which is entirely untrue, the class I am trying to run contains a public static void main(), does anyone know what's going on here?the class is quite large, I don't think that it is a problem with the class, because it runs fine on my windows based pc (also in eclipse)...
-
Selection does not contain main type
Hi All,
I am getting the Launch error saying:
"Selection does not contain main type" while running the program in eclipse.
Is there any common aspects from where it is being generated?
Thanks in advance
regardslkarmacharya wrote:
eclipse launch error: "editor doesn't contain a main type"Hi,
Please don't resurrect old threads, and this isn't an eclipse forum. I'm locking this thread. Create a new one if you have a specific Java programming related problem.
Kaj -
Selection does not contain characteristic combination
Hi Gurus,
I am very new to Planning module. When i have created planning sequence on Aggregation level for 0INM_RC02 Cube, system gives error message "Selection does not contain characteristic combination". Can any one help me what is this error msg and how to rectify this one.
With Regards,
Balachander.SHi,
you are trying to post the values which are not in combination for characteristic and its attributes.
For example :
Buisness Area, currency.
India - INR
LV10 - GBP
Now you are trying to post India - GBP,which is invalid.Check in the selection if you are deriving any characteristic on the basis of master data for which you are trying to post invalid entries.
Or
You are using characteristic relatioship for which entries are invalid.
or
You are trying to post the data which is not restricted in filter for example :-
If you have restricted currency as INR in filter and trying to post to GBP then you will get this error.
Regards,
Indu -
Error msg, "Maximum selection does not contain value 9999999999.
Hi, I am getting this error wile doing Reclassification of HFM Movement.
Error msg, "Maximum selection does not contain value 9999999999 of subassignment HFM CD2 & Asset Type "
in the Data Monitor, ( in Reclass Net Reserve). While running BCF task for a company for period 16/2009
Actually, We have converted the consolidation area from XX(2009) to YY(2010).
Before this task, user has performed the balance carry forward.
My Analysis is as follows:-
Method Used in this Reclassification
RECYX (Reclassify HFM Movement at YE lvl 10)
TRIGGER
Items : 100-299, 9900-9999
HFM Movement Type : O200 to O300
Posting Level : 10
TARGET
Items : 100-299, 9900-9999
Move : O100C
Posting Level : 10
HFM CD2 and Asset type : Ticked
After TEST run in UCMON, the error message comes :-
The "HFM CD2 & Asset Type value 9999999999" is not maintained in Breakdown Categories Y500, Y700 etc.
Breakdown categories in Workbench
Maintained as "OPTIONAL, Initialized value allowed".
Single Selection
1A
1B
AR
GA
Default Selection
99999999999
BCS CUBE
HFM CD2 & Asset Type - coming blank
LOTR
HFM CD2 & Asset Type - Coming blank
Please help to go forward.
In Anticipation,
Deepankar JainThanks a lot Dan for the reply.
Yes, the single selection is 1A, 1B etc, I agree that including this default value 9999999999 in single selection will resolve this issue, but the BREAK DOWN TYPE is OPTIONAL, that means It will also consider a blank value, right?
Also, In the method defined for RECLASSIFICATION in workbench, in the TARGET parameters, the" HFM CD2 and Asset Type" is blank but the "DEFAULT is TICKED" which makes it a mandatory derivation rule.
Please correct me if I am wrong.
Your replies on it are highly appreciated.
Thanks and Regards,
Deepankar -
Maximum selection does not contain value 600 of subassignment Subitem-error
Hi All,
I'm getting the following error when i tried to load the file through data stream.
Maximum selection does not contain value 600 of subassignment Subitem
Message no. UCD1038
Diagnosis
The posting item 11100100 has breakdown category BR01 for which a maximum selection was maintained for subassignment Subitem. The current posting value, however, is not in this maximum selection.
System Response
The posting is not possible.
Procedure
Check the maximum selection and the posting.
I have already refered the earlier threads but its of no use for me. I have checked my setting w.r.t to FS item breakdown category, Max selection in breakdown category and sub items all the setting are fine, even i applied the OSS notes no-1074599 still i'm facing the same issue.
Can any one help me with this regards, thanks in advance.
Regards,
MageshHi Dan,
Yes, breakdown category has been assigned with a sub item category which in turn assigned to subitems and this sub item is a part of the sub item category which is assigned in max. selection.
Let me know if you want any more information on the same.
Regards,
Magesh -
Error: Batch does not contain a valuation type
Hi,
When I'm trying to do MB1B for the below parameters, I'm getting the error:
Transaction MB1B
movement type 411
special stock Q
plant XXXX
storage location YYYY
WBS element a12334455674787698
material 1234
quantity n
batch 12345678
'Batch 'material no' 'plant' 'batch no' does not contain a valuation type. Message no. M7 045
But the batch has a valuation type and the material is assigned a valuation type too.
Can you please giude me to find out why is this behaviour?
Regards
JagHI, I've encounter the same problem. But I used the movement type 323 E.
I input the data as below:
material 2000000564
plant S010
storage location 2001
batch 0903011208,
and got the message M7045 saying that Batch 2000000564 S010 0903011208 does not contain a valuation type, but the batch 0903011208 do have a valuation type in it!
When I use movement type 323, there isnt' any error message returned!
so, I guess there is a bug in the program! -
FileUpload problem: InputStream does not contain a serialized object
Hi All,
I'm using the FileUpload component in a JSPDynPage and the htmlb component seems to work fine but I cannot read the file (InputStream). I get the following error(IOException): "InputStream does not contain a serialized object".
Please let me know what is wrong with my code. This is a part of the code I used:
public FileInputStream sourceFileInput;
public ObjectInputStream input;
FileUpload fu;
fu = (FileUpload) this.getComponentByName("myFileUpload");
IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
File f = fileParam.getFile();
file = fu.getFile().getFile();
absolutepath = fu.getFile().getFile().getAbsolutePath();
this.sourceFileInput = new FileInputStream(file);
input = new ObjectInputStream(sourceFileInput);
The last line of code seems to generate te error.Hi,
I have found the answers, thank you both.
(I included the examle code. Perhaps of some use to someone.)
FileUpload fu;
fu = null;
fu = (FileUpload) this.getComponentByName("myFileUpload");
// this is the temporary file
if (fu != null) {
IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
if (fileParam != null) {
// get info about this file and create a FileInputStream
File f = fileParam.getFile();
if (f != null) {
try {
fis = new FileInputStream(f);
// process exceptions opening files
catch (FileNotFoundException ex) {
myBean.setMessage(
"1" + f + ex.getLocalizedMessage());
isr = new InputStreamReader(fis);
br = new BufferedReader(isr);
String textLine = "";
do {
try {
textLine = (String) br.readLine();
} catch (IOException e) {
myBean.setMessage(
"1" + e.getLocalizedMessage());
// Jco append table & put data into the record
// (I_FILE is the table with txt data that is sent to the RFC)
I_FILE.appendRow();
I_FILE.setValue(textLine, "REC");
} while (textLine != null); -
Batch 30008068 6110 0000012614 does not contain a valuation type
Hi,
I am trying to issue a material from a very old batch but it is s giving a following error message.
BATCH does not contain avaluation type.
I want to remove a stock from the batch.
How can we remove.
Regards,
SAGARHi,
Please check for the Account Determination process for valuation class 6110. and GL account. Check entire process once.
Also, as u r saying old batch, check material master record with batch managment status and batch managment active in customizing.
While goods issue, enter batch number....
Hope this will help.
Regards,
Smitha -
Hello experts,
I'm totally new to C#. I'm trying to modify existing code to automatically rename a file if exists. I found a solution online as follows:
string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
string tempFileName = fileName;
int count = 1;
while (allFiles.Contains(tempFileName ))
tempFileName = String.Format("{0} ({1})", fileName, count++);
output = Path.Combine(folderPath, tempFileName );
string fullPath=output + ".xml";
However, it gives the following compilation errors
for the Select and Contain methods respectively.:
'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found
(are you missing a using directive or an assembly reference?)
'System.Array' does not contain a definition for 'Contains' and no extension method 'Contains' accepting a first argument of type 'System.Array' could be
found (are you missing a using directive or an assembly reference?)
I googled on these errors, and people suggested to add using System.Linq;
I did, but the errors persist.
Any help and information is greatly appreciated.
P. S. Here are the using clauses I have:
using System;
using System.Data;
using System.Windows.Forms;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Linq;Besides your issue with System.Core, you also have a problem with the logic of our code, particularly your variables. It is confusing what your variables represent. You have an infinite loop, so the last section of code is never reached. Take a look
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace consAppFileManipulation
class Program
static void Main(string[] args)
string fullPath = @"c:\temp\trace.log";
string folderPath = @"c:\temp\";
string fileName = "trace.log";
string output = "";
string fileNameOnly = Path.GetFileNameWithoutExtension(fullPath);
string extension = Path.GetExtension(fullPath);
string path = Path.GetDirectoryName(fullPath);
string newFullPath = fullPath;
string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
string tempFileName = fileName;
int count = 1;
//THIS IS AN INFINITE LOOP
while (allFiles.Contains(fileNameOnly))
tempFileName = String.Format("{0} ({1})", fileName, count++);
//THIS CODE IS NEVER REACHED
output = Path.Combine(folderPath, tempFileName);
fullPath = output + ".xml";
//string fullPath = output + ".xml";
UML, then code -
Selected model does not contain any target value prior
Hi ODM experts,
I have tried to apply the SVM alg in order to find anomalous records.The table source have rows like that:
uniq_rec ID NAME A1 A2 A3 A4 A5 data
577 2052956018 NAMEHDRCP8 2.27 0.4 85.46 0.01 14.54 24-JAN-13
578 1250914484 NAMEDJDRVP3 11.45 1.24 56.24 0.01 43.77 24-JAN-13
579 1968689283 NAMEDKEND12 0.000011 6.78 0.000029 0.01 0.091 24-JAN-13
580 2063389130 NAMEDNMXG14 0.000011 0.65 36.65 0.02 0.091 24-JAN-13
unq_rec is the pk, id is the id for the generic name and A1 .. A5 attributes ,data when collection occur etc
I'm trying to execute the following code:
drop table ALG_SET;
exec dbms_data_mining.drop_model('SVMODEL');
create table ALG_SET (setting_name varchar2(30), setting_value varchar2(4000));
insert into ALG_SET values ('ALGO_NAME','ALGO_SUPPORT_VECTOR_MACHINES');
insert into ALG_SET values ('PREP_AUTO','ON');
commit;
Begin
dbms_data_mining.create_model('SVMODEL', 'CLASSIFICATION', 'ODM_PAR_FIN_HIST', 'UNQ_CRT', null, 'ALG_SET');
end;
The results is the following error:ORA-40104: invalid training data for model build ( if I run the code) .If I run from graphical interface I have obtained this
error code " Selected model does not contain any target value prior"(using the similar model - SVM for anomaly detction plus the same source table )
Please advice what is missing or wrong and if possible how to bypass this issue.
Thanks in advance for support.
Best Regards,
BogdanHere is also a newer example of creating a SVM Anomaly model from ODM sample code (12.1 version but this applies to 11.2):
Rem
Rem $Header: rdbms/demo/dmsvodem.sql /main/6 2012/04/15 16:31:56 xbarr Exp $
Rem
Rem dmsvodem.sql
Rem
Rem Copyright (c) 2004, 2012, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem dmsvodem.sql - Sample program for the DBMS_DATA_MINING package.
Rem
Rem DESCRIPTION
Rem This script creates an anomaly detection model
Rem for data analysis and outlier identification using the
Rem one-class SVM algorithm
Rem and data in the SH (Sales History)schema in the RDBMS.
Rem
Rem NOTES
Rem
Rem
Rem MODIFIED (MM/DD/YY)
Rem amozes 01/23/12 - updates for 12c
Rem xbarr 01/10/12 - add prediction_details demo
Rem ramkrish 06/14/07 - remove commit after settings
Rem ramkrish 10/25/07 - replace deprecated get_model calls with catalog
Rem queries
Rem ktaylor 07/11/05 - minor edits to comments
Rem jcjeon 01/18/05 - add column format
Rem bmilenov 10/28/04 - bmilenov_oneclass_demo
Rem bmilenov 10/25/04 - Remove dbms_output statements
Rem bmilenov 10/22/04 - Comment revision
Rem bmilenov 10/20/04 - Created
Rem
SET serveroutput ON
SET trimspool ON
SET pages 10000
SET echo ON
-- SAMPLE PROBLEM
-- Given demographics about a set of customers that are known to have
-- an affinity card, 1) find the most atypical members of this group
-- (outlier identification), 2) discover the common demographic
-- characteristics of the most typical customers with affinity card,
-- and 3) compute how typical a given new/hypothetical customer is.
-- DATA
-- The data for this sample is composed from base tables in the SH schema
-- (See Sample Schema Documentation) and presented through a view:
-- mining_data_one_class_v
-- (See dmsh.sql for view definition).
-- BUILD THE MODEL
-- Cleanup old model with the same name (if any)
BEGIN DBMS_DATA_MINING.DROP_MODEL('SVMO_SH_Clas_sample');
EXCEPTION WHEN OTHERS THEN NULL; END;
-- PREPARE DATA
-- Automatic data preparation is used.
-- SPECIFY SETTINGS
-- Cleanup old settings table (if any)
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE svmo_sh_sample_settings';
EXCEPTION WHEN OTHERS THEN
NULL;
END;
-- CREATE AND POPULATE A SETTINGS TABLE
set echo off
CREATE TABLE svmo_sh_sample_settings (
setting_name VARCHAR2(30),
setting_value VARCHAR2(4000));
set echo on
BEGIN
-- Populate settings table
-- SVM needs to be selected explicitly (default classifier: Naive Bayes)
-- Examples of other possible overrides are:
-- select a different rate of outliers in the data (default 0.1)
-- (dbms_data_mining.svms_outlier_rate, ,0.05);
-- select a kernel type (default kernel: selected by the algorithm)
-- (dbms_data_mining.svms_kernel_function, dbms_data_mining.svms_linear);
-- (dbms_data_mining.svms_kernel_function, dbms_data_mining.svms_gaussian);
-- turn off active learning (enabled by default)
-- (dbms_data_mining.svms_active_learning, dbms_data_mining.svms_al_disable);
INSERT INTO svmo_sh_sample_settings (setting_name, setting_value) VALUES
(dbms_data_mining.algo_name, dbms_data_mining.algo_support_vector_machines);
INSERT INTO svmo_sh_sample_settings (setting_name, setting_value) VALUES
(dbms_data_mining.prep_auto, dbms_data_mining.prep_auto_on);
END;
-- CREATE A MODEL
-- Build a new one-class SVM Model
-- Note the NULL sprecification for target column name
BEGIN
DBMS_DATA_MINING.CREATE_MODEL(
model_name => 'SVMO_SH_Clas_sample',
mining_function => dbms_data_mining.classification,
data_table_name => 'mining_data_one_class_v',
case_id_column_name => 'cust_id',
target_column_name => NULL,
settings_table_name => 'svmo_sh_sample_settings');
END;
-- DISPLAY MODEL SETTINGS
column setting_name format a30
column setting_value format a30
SELECT setting_name, setting_value
FROM user_mining_model_settings
WHERE model_name = 'SVMO_SH_CLAS_SAMPLE'
ORDER BY setting_name; -
Does not contain a static 'Main' method suitable for an entry point_
Hello
I want to to do a project with Entiity Framework . I add a project to my solution for my domain class and it's name is 'LinkModel.DomainClasses'. when I prees F5 there is an error like bellow.
Could You help me to solve this? thanks alot
..\Documents\Training\LinkCodeFirstLast\LinkCodeFirst\LinkCodeFirst\LinkModel.DomainClasses\obj\Debug\LinkModel.DomainClasses.exe'
does not contain a static 'Main' method suitable for an entry pointHi bkshn,
This error is caused by the missing "Main" method in your project. it is the entry point of your project.
If you want to create a EF project, you could follow the way in the aricle below.
https://msdn.microsoft.com/en-us/data/ee712907#codefirst
The Main method is like below.
class Program
static void Main(string[] args)
using (var db = new BloggingContext())
// Create and save a new Blog
Console.Write("Enter a name for a new Blog: ");
var name = Console.ReadLine();
var blog = new Blog { Name = name };
db.Blogs.Add(blog);
db.SaveChanges();
// Display all Blogs from the database
var query = from b in db.Blogs
orderby b.Name
select b;
Console.WriteLine("All blogs in the database:");
foreach (var item in query)
Console.WriteLine(item.Name);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
And you could start to learn the EF from the following MSDN blogs.
https://msdn.microsoft.com/en-us/data/ee712907
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I have F.F 3.6 and windows 7.: 1) When i want to buy a airplane ticket and want to select 2 adults or 2 children, the draw down select, does not work in any websides,? WHY?. 2) Have FF any problems with SKYPE
== This happened ==
Not sure how often
== After innstalling windows 7As a suggestion I'd put the Text_io segments into their own begin - exception - end sub-blocks within the main code. This way if Text_io does raise an exception you can catch it earlier as it may be able to recover - That is if it is a text_io exception.
Other than that you;ll have to step through in Debug.
Maybe you are looking for
-
Does anyone know how to fix keynote when it won't start up?
-
How do you remove iOS8 update. How do you avoid using iCloud
How do I remove iOS 8 update? it is locking up my phone because I do not want iCloud.
-
Groupwise 8 in Mac OS X 10.6 Snow Leopard, Java Error
Upgraded my Mac to the new Snow Leopard. When I start the Groupwise Client (runs in Java) on it I get a "Cannot Launch Java Application" with the following error "Uncaught exception in main method: java.lang.NullPointerException" any one know a work
-
Bridge ratings lost when switching to filter tab
I lose my ratings when I switch to the filter pane of bridge, This has happened after running all of the most current updates including reinstalling software. Editing twice on several thousand images is no fun. The ratings, stars, show up in the file
-
Help with action usage by user setup
I am trying to setup the action usage and have been running the action log background job for 3 day now but i am not seeing any vlaues when i run the action usage by user report. Is there a way i can check if i have confiqured system correctly or eve