Having trouble with "main" method

I have just installed j2re1.4.1 and I am having trouble running my applications. Every time I try to run even the smallest of apps I get an error message about the "Main" method.
In textpad i get this message:
"Exception in thread "main" java.lang.NoClassDefFoundError:"
and in Jcreator I get this message:
"The system couldnt find a suitable main method"
what is going wrong?How can I fix this?

It could be something as simple as Case :-/
If you have a file Foo.java with a class Foo with a main()
you can compile it with javac foo.javawhich will create Foo.classbut you cannot run it with java fooyou will get Exception in thread "main" java.lang.NoClassDefFoundError: roids (wrong name: Foo)whereas java Foowill work just fine.

Similar Messages

  • Calculator: having problem with main method

    This is a program that converts Infix expression to Postfix and evaluates it.I used eclipse to run this.
    In my main method, how do i get it to loop? when the user still wants to input another expression? i just can't seem to figure this out.
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class Calculator {
         private static Stack operators = new Stack();
         private static Stack operands = new Stack();
         private static int precedence( char operator ) {
              if (operator == '+' || operator == '-' )
                 return 1;
              else if (operator == '*' || operator == '/' || operator == '%')
                  return 2;
              return 0;
         private static String convertToPostfix( String infix ) {
         StringTokenizer input = new StringTokenizer( infix );
         String symbol;
         String postfix = "";     
         while (input.hasMoreTokens()) {          
             symbol = input.nextToken();     
              if (Character.isDigit(symbol.charAt(0))){
                  postfix = postfix + " " + (Integer.parseInt(symbol));     
              }else if (symbol.equals("(")){ 
                   Character isOperator = new Character('(');
                   operators.push( isOperator );
              }else if (symbol.equals(")")) {
                   while (((Character)operators.peek()).charValue() != '(') {
                       postfix = postfix + " " + operators.pop();
                   }operators.pop();
              } else {
                   while (!operators.empty() && !(operators.peek()).equals("(") && precedence(symbol.charAt(0)) <= precedence(((Character)operators.peek()).charValue()))
                        postfix = postfix + " " + operators.pop();
                        Character isOperator = new Character(symbol.charAt(0));
                        operators.push( isOperator );
              while (!operators.empty())
                   postfix = postfix + " " + operators.pop();
                        return postfix;
         private static int evaluate( String postfix ) {
         StringTokenizer input2 = new StringTokenizer( postfix );
         int value;
         String symbol;
         while (input2.hasMoreTokens()) {
             symbol = input2.nextToken();
              if (Character.isDigit(symbol.charAt(0))) {
                  Integer isOperand = new Integer(Integer.parseInt(symbol));
                   operands.push( isOperand );
              }else{
                   int op2 = ((Integer)operands.pop()).intValue();
                   int op1 = ((Integer)operands.pop()).intValue();
                   int result = 0;
                        switch(symbol.charAt(0)){
                             case '*': result = op1 * op2;
                                            break;
                             case '+': result = op1 + op2;
                                            break;
                             case '-': result = op1 - op2;
                                            break;
                             case '/': result = op1 / op2;
                                            break;
                             case '%': result = op1 % op2;
                                            break;
                        Integer isOperand = new Integer(result);
                        operands.push( isOperand );
              value = ((Integer)operands.pop()).intValue();
              return value;
         public static void main(String args[]) throws IOException {
                     JOptionPane.showMessageDialog(null,  "Hello user! I hope you have a wonderful time using the
                        calculator.  = ]"  , "Welcome", JOptionPane.PLAIN_MESSAGE);     
                  JOptionPane.showMessageDialog(null,  "Note: Enter Infix expressions with spaces in between.",
                        "Welcome", JOptionPane.PLAIN_MESSAGE);
                  String infix = JOptionPane.showInputDialog("Enter Mathematical Expression Here: ");
                  String output = "The expression in Postfix is: " +  convertToPostfix(infix);
                  JOptionPane.showMessageDialog(null, output);
                  String answer = "The answer to the equation:  " + evaluate(convertToPostfix(infix));
                  JOptionPane.showMessageDialog(null, answer);
                       String options[] = {"Yes","No",}
                   int option = JOptionPane.showOptionDialog(null,"Do you want evaluate an expression?", "Calculator",  
                       JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,options,options[0]); 
                  JOptionPane.showMessageDialog(null,  "Thank you for using the calculator.\n Have a nice day!  = ]");
    }

    Can probably be done better...
    boolean stop = false;
    while(!stop) {
    //your optionpanes..
         if(option == 0) {
              stop = true;
    }Also, your yes/no optionpane could be exchanged to:
    int option = JOptionPane.showConfirmDialog(null,"Do you want evaluate an expression?", "Calculator", JOptionPane.YES_NO_OPTION);Edited by: prigas on Sep 20, 2008 12:04 PM

  • I recently added my old mac hard drive to a new macbook with an SSD as my main OSX drive.  I am having trouble with permissions in viewing my old hard drive.  What is the best way to get complete access to my old hd installed in my new Macbook?

    I recently added my old mac hard drive to a new macbook with an SSD as my main OSX drive. I am having trouble with permissions in viewing my old hard drive, when I save a permission when I reboot the full access is changed again .  What is the best way to get complete access to my old hd installed in my new Macbook?

    Open the Get Info window for the old drive. Click the Lock icon on the bottom of that window and type in your password. In the permissions area click the Plus sign ( + ) and Add your Username to it and set it to Read & Write. Close that window. you should now have full access to all the files.

  • Since installing the new OS i am having troubles with different appliction icons showing up on my main page twice (upper left corner), and not allowng me to select certain ones (app store specifically).   Anyone else having this issue?

    Help - anyone else out there having trouble with the new OS system on their ipad 2?    I am not getting mutliple copies of several apps ont he main page.  They are "collecting: in a pike int he upper left corner and the original application icon is no lobger working.    I have tried a hard sync, and that didn't help.

    It should only be able to have one copy of an app on the iPad. Have you tried a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    Do all the apps work ? In the past a few people have taken a screen shot of their iPad screen and that has then become their background picture - so some of the 'app's may actually be on your wallpaper picture and not actual apps. Have you tried changing the wallpaper to see if that makes any difference ?

  • I'm having trouble with the develop module in LR5.4. Any adjustments are taking effect, but only viewable in the filmstrip, not on the main photo. The navigator will go grey, as does the main area too. This applies to all edits done in develop module. I h

    I'm having trouble with the develop module in LR5.4. Any adjustments are taking effect, but only viewable in the filmstrip, not on the main photo. The navigator will go grey, as does the main area too. This applies to all edits done in develop module. I have posted several times on the forum with no responses to address this, and have seen others with the same issue. I have even gone as far as to do a complete re-install of LR5, with no success. I'm at a loss, and I depend on it for so much editing. Please help.

    Reset your preferences file: Resetting (or 'Trashing') the Lightroom Preferences file - Lightroom Forums
    Report back if that doesn't work.

  • Having trouble with mail..Wheel spins and mail hangs up when mainly when sending

    Having trouble with mail..Wheel spins and mail hangs up when mainly when sending

    Have you many items in outbox? Seen this where a message has a large attachment and I stuck

  • Having trouble with throws...

    Hey there.
    I'm fairly new to java so bear with me here.
    I'm having trouble with a program that, in short, reads from a file.
    Let me shorten a show the code to you...
    //main opens up and in a bit we get to...
    if (loginVerify())
    //and the if continues.
    fileIn.close();
    //main ends
    public boolean loginVerify() throws IOException
         openIn(); //Checks for validity - It's a long story why I //didn't just put the code in loginVerify(). I //don't think it should matter.
    String str = verifyLog(); //Does the actual reading
         str = str.substring(1);
         if (str == placeHold) //Don't worry about not making placeHold,
    //I made it global for testing reasons.
              return true;
         else
              return false;
    private String verifyLog() throws IOException
         String str;
         while (true)
              str = fileIn.readLine();
              if (str == null)
                   break;
              else if (str.charAt(0) == 1)
                   return str;
              //ADDITION OF OTHER NUMBERS
              else
                   return str = "invalid";
    private void readIn() throws IOException
         BufferedReader console =
    new BufferedReader(new InputStreamReader(System.in));
    openInputFile(fileName);
    if (fileIn == null)
    System.out.println("*** Can't open " + fileName + " ***");
    return;
    private static void openInputFile(String fileName)
    try
    fileIn = new BufferedReader(new FileReader(fileName));
    catch (FileNotFoundException e)
    So it's fairly simple. It checks for validity and then reads lines until it finds one with the first char as '1' when it finds it, it reads the rest of the line off.
    The error I'm getting is as follows: Exception java.io.IOException must be caught, or it must be declared in the throws clause of this method.
    I've added throws IOException to them in attempts to fix the error but to no avail. I've tryed putting the catch in different spots... again, doesn't work.
    I'm using codewarrior IDE version 5. I'm fairly sure it's the newest. I installed Java SDK 1.3 with codewarrior originally but I installed 1.4.1 recently.
    If you need to see anything else about it, please tell me. I'd be more than happy to post a little more if it'll help.
    Thanks

    Ok. I worked through a bunch of throws and now I've found one I can't seem to conquer.
    private String verifyLog()
           String str = "";
           while (true)
                try {
                str = fileIn.readLine();
                catch (FileNotFoundException g) {
                if (str == null)
                     break;
                else if (str.charAt(0) == 1)
                     return str;
                //ADDITION OF OTHER PEOPLE
                else
                     return str = "invalid";
           return str = "invalid";
      }This time the error is at the reference to readLine() and it tells me the same error as before. I have a catch set up there, don't I?
    readLine() is something I didn't create so I don't know how I'd tell it to throw an exception if I had to...
    Thanks

  • I down loaded ios7 and now I'm having trouble with my audio on Skype, does anyone knows how to fix it? Please help!

    WWith the new ios7, I became frustrated in using my iPad3..I'm using Skype as my main communications with my love ones back home,now it seems that ios7 doesn't help me a lot for I'm having trouble with my audio communication coz my family can't hear anything from me.. My skype doesn't have any options or settings that I can check with to see if I can fix it...I need help...please if any of u knows how to fix it..I would greatly appreciate it...

    You can try removing app then reinstalling. If that doesn't work
    Try a Restart. 
    Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider. Press and hold the Sleep/Wake button until the Apple logo appears.
     Resetting your settings
    You can also try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. You won't lose any data, but it takes time to enter all of the settings again.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears. Apple recommends this only if you are unable to restart it.
    Or if this doesn't work and nobody else on the blog doesn't have a better idea you can contact Apple. 
    Here is a link to their contacts with most of the information below. 
    http://www.apple.com/contact/

  • Having trouble with persist

    I have created a simple application where a user can order items and then i'm saving the order and all the items (details of order) to the dataBase.
    i'm using jdk1.5 with jboss and mySql (also hibernate).
    i'm having troubles with saving the details of the order, the relevant code is-
    order entity -
    @Entity
    public class Orders implements Serializable
        @Id @GeneratedValue
        private long orderId;                    //generated in db
        private String name;
       public Orders(String userName)
            this.userName=userName;
        public long getOrderId() { return orderId; }
        //getters and setters...
    detailsOfOrder entity -
    @Entity
    public class DetailsOfOrders implements Serializable
    @Id
    private long orderId;
    @Id
    private int productId;
    private int quantity;
    public DetailsOfOrders(long orderId,int productId)
         this.productId=productId;
         this.orderId=orderId;
    public long getOrderId() { return orderId; }
    public int getProductId() { return productId; }
    //getters and setters...
    }session bean (order method) -
            List<SCItem> listOfItems;                         //SCItem is a regular class
            Orders order=new Orders(userName);
            manager.persist(order);
            long orderId=order.getOrderId();   //get order id after persisting
            for(SCItem item : listOfItems)    //save details of order
             DetailsOfOrders detail=new DetailsOfOrders(orderId,"1");
             manager.persist(detail);                                                   //exception occures here
           }when i'm trying to make an order i'm getting the exception-
    javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
    what is the problem?
    thanks in advanced.

    yes, the entity classes have no-arg constructors (i just tried to write it shortly here...)
    about the other thing , well i'm sorry , the right code is-
    session bean (order method) -
       List<SCItem> listOfItems;                         //SCItem is a regular class
       Orders order=new Orders(userName);
       manager.persist(order);
       long orderId=order.getOrderId();   //get order id after persisting
       for(SCItem item : listOfItems)    //save details of order
         DetailsOfOrders detail=new DetailsOfOrders(orderId,item.getProductId());
         manager.persist(detail);                                                   //exception occures here
         }what else could it be?

  • I just bought a new computer and im having trouble with transferring my purchased songs to my iphone please help

    im having trouble with tranferring my purchased songs to my iphone . The problem is that im using my house desktop windows computer because my laptop is broking and all my songs are mainly on that one . Right now im trying to see if i can tranfer my purchased songs from the desk top itunes to my iphone .Its not showing me options for my perdiciment please help!!.

    Plug it in and sync it.
    What is the issue?
    It will erase the current content and replace with content from the new computer.

  • HT4623 I am having trouble with my iPod 5th gen after iOS update. It's in recovery mode and iTunes keeps timing out when I try to restore it. What should I do???

    I am having trouble with my iPod 5th gen after iOS update. It's in recovery mode and iTunes keeps timing out when I try to restore it. What should I do??? If possible, I would also like to keep all of my data.

    Maybe this will help:
    Troubleshooting
    As with all clickwheel iPods, you can reset this iPod by first toggling the hold switch on and off and then simultaneously pressing the select (center) and menu buttons for approximately 5-10 seconds. This is a common fix should your iPod behave unexpectedly or lock up. Once reset, the iPod should display an Apple logo for a few seconds before showing the main menu. This procedure is similar to rebooting a computer and damages none of your music or data.

  • Having trouble with wav files and sample rates

    Hi ,I am having trouble with wav files and sample rates .I have been sent multiple projects on wav as the main instrumental ; I wish to record in 48.000kHz .Now comes the problem.When I try to change the project to 48k It seems to pitch up the track.I can't have them send the logic/project file as most have outboard synths,different plug ins etc.This particular case the producer has recorded the synth task in 41.000 kHz .My successful outcome would be to be able t create a project file in 48 kHz .And NOT pitch up whne I add the instrumenta wav file .Any help would be gratefully recieved,this is my first post so any mistakes I may have made go easy 

    You'll have to convert the actual synth audio file file that the producer gave you to 48kHz. You can do this in the audio Bin in Logic.

  • Has anyone started having trouble with google calendar syncing / showing up on their iPhone 4s or iPad? As of today my google calendar not longer appears on either device.

    Has anyone started having trouble with google calendar syncing / showing up on their iPhone 4s or iPad 2? As of today it no longer shows up. Thanks.

    Let me re-qualify my issue. Under my Google Calendar account I have the main calendar I originally set up when setting up my account. I then set up several other calendars under this same account such as events, work, family and so on. All the calendars showed up on my iPhone and iPad with no problem and worked great for a year and a half now until yesterday. My main calendar does still show up but the others no longer appear on my devices. Going on line to look at my Google calendar/calendars everything is fine with all of them. Any thoughts as to why they no longer show up on my iPhone or iPad? Thanks again.   

  • Having trouble with the video function..

    I just purchased the 60GB ipod photo. I'm transferring music files easily. However, I'm having trouble with the video function. I've loaded Itunes 6, reloaded the original setup disk, and have loaded the latest updates for the unit. I can download movies from the itunes store and save them to my library, but I cant seem to transfer the video files to the ipod. Ive reinstalled itunes and the update 6 with no success. After syncing the ipod it only shows the music files even after all that Ive tried. Additionally, there is no evidence of the video function on the main menu after the update attempts. Can someone tell me what I'm doing wrong? I'm eager to get past this problem so that I can start tranfering personal movies and video files.

    You Have an iPod Photo, You do NOT have a 5th Generation Video iPod. Get it? You need the 5G model to play video.
    If the salesman told you it was the 5G model he lied, was ignorant or both. If video is important or if thats what you thought you were getting you will need to return your 4G iPod photo for new iPod.
    Rotsa Ruck!

  • I'm having trouble with my apple id banking details

    i'm having trouble with my banking details for my apple id as it keeps saying that the payment method is being declined and to put in an alternative method but i'm not sure what to do as no money is going in or out of the bank when downloading apps

    Hello willowfrombgr,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iTunes Store: Changing your payment information
    http://support.apple.com/kb/ht1918?viewlocale=nl_nl
    If your account information doesn't match your credit card, you may get a message stating "The credit card was declined."
    Best of luck,
    Mario

Maybe you are looking for

  • Looking for a webmail with multiple accounts support

    Hi, I would like to set up a webmail on my server which I will use to check my various mail accounts on gmail and others. I tried mutt, alpine, claws-mail, but I don't really like "true" mail clients, I prefer to use webmails (so it can render HTML m

  • Multiple Copies of Composed Emails in Trash

    I am using Mac Mail with OS X 10.8.2 with my Gmail account.  When I compose an email it keeps quite a few draft copies of an email I am composing in the trash folder.   The longer I take to compose the email the more copies there are.  For example in

  • External HD in use?

    I have a: Model: LaCie BigDisk Extreme, Capacity: 467.52 GB, Bus: FireWire 800, Bus Location: External, LaCie Big Disk Extreme. It keeps "clicking"(like something is happening, & the "blue lite" flashes for a few seconds every now & then BUT I'm NOT

  • I want to personalize my ringtone.  I downloaded some ringtones but can't find them in my settings?

    I am trying to set my ringtone on my new iphone.  I tried going into settings but the ringtone that I downloaded is not showing up.  Anyone have any ideas?

  • Opening Images With Safari

    When I open an image on the desktop, it opens with Preview as the default. How can I switch to opening images with Safari as the default?