I get NoSuchMethodError but cant run program with Static

Hi, I got this silly problem. My program is meant to display a input dialog an then write to a file. Sounds so simple. But java wanted to make things hard for me and i got a NoSuchMethodError. I know that i am meant to us Public Static Void Main (String arg) but when i do this i get error "this can be referenced as static". Here is the source, do you know how to fix this.(an how can i?)
Thnx
My Regards
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.String;
public class sender implements Runnable {
int i= 0;
String mes;
public void main (String[] arguments) {
Thread th = new Thread (this);
th.start ();
//sender();
while (true){}
public void start () {
Thread th = new Thread (this);
th.start ();
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {}
String mesdialog = JOptionPane.showInputDialog(null,
"Enter your message");
mes = mesdialog.toString();
try {
//FileOutputStream of = new
//FileOutputStream ("send.txt");
FileWriter of = new
FileWriter("send.txt");
//BufferedReader in = new
// BufferedReader(fr);
//while (true) {
int i = 66;
boolean eof = false;
int inChar = 0;
do {
inChar = mes.hashCode();
if (inChar != -1) {
char outChar = (char)inChar ;
of.write(outChar);
//of.write(mes,0,20);
} else
eof = true;
} while (!eof);
//outfile.write(input);
} catch (IOException e) {
System.out.print("AAA ERROR");}
}

public static void main (String[] arguments) {
Thread th = new Thread (new sender());
th.start ();
//sender();
while (true){}
}You can't reference "this" from a static context. main is required to
be static.
matfud

Similar Messages

  • Running Programs with Screen Closed

    I cant figure out how to run programs with my screen closed. For instance, I'm signed on AIM and I close the screen and when I open it back up, I'm no longer signed on AIM. It's very frustrating. Any type of assistance would be greatly appreciated. Also, is there any phone number available that will connect me directly with customer service?

    Unfortunately, unlike PC counterparts, your laptop has 1 function with the laptop on, and screen closed - Sleep.
    Sleep can be reversed with closing the lid as described above, having an EXTERNAL mouse and or keyboard and activating the computer that way.
    It is really designed to run closed when use with a large display - that is what that feature is.
    Unfortunately you either have to keep your lid open, or accept the fact that you won't be on AIM when you close the lid.
    Now please don't get offended with the last part I have to say about AIM:
    I used to hate the fact that when I closed the lid, I was kicked off AIM. I now love it. The reality is that none of us are really all THAT important that signing out of AIM is the end of the world. There's email, and there's the telephone if someone has something emergent, urgent, important, or barely important to tell someone.
    I feel like AIM has dumbed down communication as we know it, creating a world of "acquaintances" and "buddies" instead of "friends".
    Like I said, please take no offense, i just think we all deserve time away from AIM...
    Sorry there aren't any other solutions for you.

  • How can I get my games to run smooth with apple tv. I'm getting jerky movement

    How can I get my games to run smooth with apple tv?

    Check your network for interference (www.istumbler.net, check router manual in regards to changing channels) and other activities possibly running in the background.

  • I have have my photos in the Creative Cloud but cant see them with Ligthroom.

    I have have my photos in the Creative Cloud but cant see them with Ligthroom.
    These photos were sent to me by photgraphers who have edited the photos and added captions and technicala information that shoudl be seen in Lightroom.
    I cant open the photos that are in Creative Cloud in Lightroom and therefore acant access the captions and the other specifics regarding copyright etc
    Any help would be great
    Thanks

    The photos on CC will be synced to a folder on your hard drive.
    You need to import into Lightroom from that folder.
    If you have them on Behance, it’s possible to use the  Publish Services tab.

  • TS3274 My ipad2 is not responding..I want to restart it but i can get nothing but a black screen with only the apple logo and a small gear icon. It occasionally beeps but no other response.  Any ideas as to what may be wrong and what I can do?

    My ipad2 is not responding..I want to restart it but i can get nothing but a black screen with only the apple logo and a small gear icon. It occasionally beeps but no other response.  Any ideas as to what may be wrong and what I can do?

    Try:
    - iOS: Not responding or does not turn on
    - If not successful and you can't fully turn the iPad fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.

  • CAN COMPILE BUT CANNOT RUN PROGRAM

    I am finally able to compile my program, I have the extensions .class, when I try to run the program I get an error message "main"java.lang.noclassdef
    after message appears after I type java Saluton or whatever program I am trying to run.
    Any suggestions, someone justed I use textpad, but I don't think this has anything to do with not being able to run programs, I am using windows 98 second edition.

    This is a CLASSPATH problem.
    For example, if your .class file is in the directory C:\javaclasses then you would set the CLASSPATH environment variable to that using:
    set CLASSPATH=C:\javaclasses
    Add this to your autoexec.bat and reboot so you don't have to type this every time you open a DOS prompt.
    You may want to add the current directory, ., to the list of directories (use ; to separate directories).
    set CLASSPATH=.;C:\javaclasses
    If your class is part of a package, you have to use the directory that is the parent of the packages' directories.

  • Trying to run programs with java 1.4.2_07 after upgrading Eclipse

    Hi All,
    I'm using Eclipse version 3.1.0 and java 5.0 (1.5.0_03). I changed the JRE of a program back to 1.4.2_07, but when i try to run it i get this:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: controller/Controller (Unsupported major.minor version 49.0)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)What the %^#@ ? Will appreciate any help.
    Regards,
    snayit

    Also, another thing people may want to try. A coworker was having a problem where she kept getting the unsupported major minor version error from eclipse after upgrading to the latest version of java.
    All the configuration settings were correct, pointing to the latest vm. I tried starting eclipse with the parameter
    -vm "C:\Program Files\Java\jdk1.5.0_04\jre\bin\javaw.exe"
    and it worked just fine. Without this, it was apparently finding some conflict between jdk1.5 and the older jdk1.4.
    IDE's are nice, but I find configuring them after an upgrade to be exremely painful.

  • Cant run program using modules in Netbeans

    Hi all,
    I wrote a program using netbeans modules and I can't run it,
    Does anyone knows why?
    I even tried to run it using CLI commands by moving to the directory where the jar file located and write the command:
    java -jar <file package> but I got the following error :
    Execption in thread "main" java.lang.NoClassDeFoundError: /org/jdesktop/layout/GroupLayoutGroup.
    Can someone please help me with this issue?

    no clue???????????

  • Stop Running Programs with Java

    Does anyone know how to stop a non-Java program that is currently running on a PC?

    Hi,
    did you started the programm from your java app with proc = Runtime.getRuntime.exec()?
    If yes, you can kill it with
    proc.destroy()If not, there is no platform-independent way to do it.
    Best regards,
    Martin

  • Hp photosmart 7520 - can fax, get calls but not receive fax with bundoed service and wireless router

    I finally got the printer set up to my wireless router and am able to fax and receive calls but now I can't send a fax.
    I have a bundled service phone, internet and cabl;e with voice mail.
    I have reduced the number of rings to 2 and turned off automatic answer.  ready to pull my hair out!!
    HP tech service was no help and neither was the cable company.  Got this far on my own but hit a wall!
    any thoughts?

    Hello @mull274 , and welcome to the HP Forums, I hope you enjoy your experience!
    I see you are running into fax issues.  I would like to help.
    I would recommend performing a power reset on the printer.  Disconnect the power cord from the printer and the power outlet, then wait 60 seconds. After 60 seconds, plug the printer back in. Ensure you plug the printer directly to a wall outlet. Make sure to bypass any sort of surge protector or power bar.
    I would also recommend this document on Fax Sending Fails Intermittently.
    Good luck and please let me know the results of your troubleshooting steps. Thank you for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • Iphone 5 stuck at a black screen.. Siri works but cant shut down with power button

    I was on instagram and it froze I hit the power button to put it to "sleep" and I tried to open it back up and its been stuck at a dark screen. I tried holding the power button in order to reset and nothing happens.. When I press the home button siri turns on but I can't get anywhere with that either.. Help please!!

    Hold down the home/sleep button together until you see the apple logo and then release.

  • Powerpivot Config 2013 validates but cant "Run"

    I have the following
    VM with Server 2008 R2 SP1 64 bit
    logged in with my own domain account I installed
    Sharepoint Enterprise, not configured
    SQL Server Enterprise, set analysis service service account to a different domain account
    When I try to "Validate" with 2013 Powerpivot Config Tool, I can get the first page to validate. I have used the analysis services account as the default account
    When I "Run" the wizard can not Configure New Farm. Gives "Exception while executing action ConfigureNewFarm: Exception while probing for configured farm:
    On the Output tab, I notice that during the Validation process, there is this text
    01/04/14 11:00:35:2280 Verbose: Value (9999) for parameter (SharePoint Central Administration Port) is set.
    01/04/14 11:00:35:2290 Verbose: UserSecurity.ValidatePassword -- validating user:  XXXX\iet.powerpivotsvc
    01/04/14 11:00:35:2730 Verbose: UserSecurity.ValidatePassword -- user validation failed, attempting an interactive logon in case cached credentials are present
    01/04/14 11:00:35:3491 Verbose: UserSecurity.ValidatePassword -- User validated
    01/04/14 11:00:35:5015 Verbose: Action: Validating Password Phrase
    01/04/14 11:00:35:5015 Verbose: Result: True
    Later, during the Configure Farm process, I get this information about the username
    01/04/14 11:00:59:9096 Verbose: SharePoint Products Configuration Wizard version 15.0.4420.1017. Copyright (C) Microsoft Corporation 2012. All rights reserved.
    01/04/14 11:00:59:9096 Verbose:
    01/04/14 11:00:59:9096 Verbose: The password parameter specified with the configdb command is invalid.
    01/04/14 11:00:59:9096 Verbose: The password specified for the username account is invalid.
    I have tried lots of variations, and read lots of suggestions. Am I having an issue with the default account, or perhaps with the account I am logged on with, or perhaps with VM?

    Hello,
    Server administration must be through SharePoint Central Administration and the PowerPivot Management Dashboard. Never use the Services console application or SQL Server Configuration Manager to change the service account. I strongly recommend you refer
    to the following article:
    Configure PowerPivot Service Accounts:
    http://technet.microsoft.com/en-us/library/ee210642(v=sql.110).aspx
    If this issue still persists, please refer to the steps to install Analysis Services Server in SharePoint Mode for SharePoint 2013 in the article below:
    http://technet.microsoft.com/en-us/library/jj219067.aspx
    Install SQL Server BI Features with SharePoint 2013 (SQL Server 2012 SP1):
    http://technet.microsoft.com/en-us/library/96ce12ba-0ce1-40dd-94a3-0c7fcd7f9010
    Hope this helps.
    Regards,
    Elvis Long
    TechNet Community Support

  • Run program with variant

    i want to run my program always with the same variant how????

    Hi,
    You can set default value using 'default value' in select-options and parameters.
    check the links below
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba75335c111d1829f0000e829fbfe/content.htm
    you can also set default variant for a report. check the link below
    http://www.abapcode.info/2008/09/selecting-variants-for-initial-alv-list.html
    regards,
    mani

  • How to run programs with older version (windows 98)

    I purchased a software that runs on WINDOWS 98 system..VIRTUAL DJ SOFTWARE..BUT, I cannot run it on my system, which is: WINDOWS 7..HP Notebook G72B54NR..MY QUESTION: "IS THERE A WAY FOR ME TO ALLOW MY HP NOTEBOOK TO ALLOW THIS OLDER VERSION TO OPERATE ON MY WINDOWS 7 SYSTEM"?

    Do you recieve any kind of error message when trying to run it?
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Opening file to automatica​lly open and run program with input file

    My program has the ability to save and open a text file with a custom extension.  How do I make the system in which the program is being installed to recognize this file to open the program, AND how to I gather the input file in my program and load it.
    Thanks
    Solved!
    Go to Solution.

    Ok I have found on a different thread how to setup/register the file path association in the classes root.  What I don't understand is how my program will know what the input file is.  For example, the reg setting is C:/.../MyProgram.exe %1
    When my program loads, is the %1 in the argc/argv part of the main thread? And if so, how do I debug/test this?
    Thanks

Maybe you are looking for

  • Error in the procedure block

    Hi , I'm getting the error in the following block.. Could you please give a hint to solve this Solved Thank you Edited by: Smile on Feb 19, 2013 2:04 AM

  • How i can make Flash Slidsdhow  effect

    i want to make Flash Slidshow for my web ...but i dont know how. i wanted to make a flash effect which make front image into small pices and move from left to right ...like air taking them away ....and after 10 seconds in background we can see the ot

  • How can I track emailed pictures?

    I send out copies of iPhoto pictures to a group of kids from age 8 through 17.  It is a tedious task, and generally takes about 2-weeks to complete.  Is there a mechanism in iPhoto '11 that allows information that tracks which pictures have been sent

  • How  to  use  same  iTunes  for  iPhone 5s & iPhone 3gs

    Hi! I have  recently  purchased  iPhone 5s in India. I am  having  iMac (2008 model-Intel Core 2 Duo-2.4 GHz speed)  and  MacBook laptop(white polycarbonate--13"-Mid 2010)  both registered  in  my  name. iTunes  account  is  in  my  name  in  both  d

  • Weblogic 8.1 to 9.1 upgradation steps on solaris

    Can any body have any documentation explaining what are the steps involved in upgrading weblogic 8.1 to 9.1.What are the changes required to do during the upgradation?