Newbie question: cannot find symbol symbol: class STRING

I've just decided to teach myself some java, and on my first try something's going wrong and I don't know what it is.
I'm currently doing this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html
and everything is good until I try to compile it and I get this error in the cmd
HelloWorldSwing.java:30: cannot find symbol
cannot find symbol
symbol: class STRING
everything has been written verbatim from the tutorial, including "import javax.swing.*;"
What's wrong with it and how do I fix it?

Hi,
I saw the coding that You had given a link in your post. Change the following
    public static void main(String[] args) {bye for now
sat

Similar Messages

  • "Cannot find the main Class. Program will exit."

    Hi, I created a program, and I am trying to distribute it to other people in my office. I tried using both NetBeans 6.8/6.9 and eclipse. I exported to a single jar file. When I run this single .jar file, it runs perfectly. I sent it to one of my coworkers, and the message "Cannot find the main Class. Program will exit." popped up. I then had IT update his Java to 6.20 and it worked. The problem is that this program must be distributed to over 100 people, and I cannot have them each update their Java individually, nor will IT update everyone's on their own. They all have Java 4.XX I believe. Is there any way around this error that only happens on older versions of java? I have checked my manifest file and what not, as I said it runs on computers with Java 6.

    AndrewThompson64 wrote:
    Do you mean Java 1.4? It is best to be sure, so point some of the target machines at this page(1) to check.Yes, Sorry I meant 1.4.XX, I think they have 1.4.2_19.
    >
    >
    a) Ensure the code does not use functionality introduced in later versions, e.g. assertions, generics, for-each loops.. Using the [cross-compilation options of javac|http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html#crosscomp-options] will warn of those.
    b) Ensure the code does not use any classes, attributes or methods that were not available in the earlier version, then use the cross-compilation options of javac when compiling. Actually the second will alert of the first, so long as the -bootclasspath parameter is used with an appropriate rt.jar.I believe that everything is ok, unless some of the swing functions cannot be used in 1.4. Besides the swing functions (which I am not sure about) everything should be able to be used in 1.4
    Thank You

  • Complete newcomer question (cannot find symbol)

    on terminal, I was given 20 error messages...
    DemoVariables.java:11: cannot find symbol
    symbol : variable sum
    location: class DemoVariables
    sum = value1 + value2;
    ^
    DemoVariables.java:11: cannot find symbol
    symbol : variable value1
    location: class DemoVariables
    sum = value1 + value2;
    ^
    DemoVariables.java:11: cannot find symbol
    symbol : variable value2
    location: class DemoVariables
    sum = value1 + value2;
    ^
    DemoVariables.java:12: cannot find symbol
    symbol : variable difference
    location: class DemoVariables
    difference = value1 - value2;
    ^
    DemoVariables.java:12: cannot find symbol
    symbol : variable value1
    location: class DemoVariables
    difference = value1 - value2;
    ^
    DemoVariables.java:12: cannot find symbol
    symbol : variable value2
    location: class DemoVariables
    difference = value1 - value2;
    ^
    DemoVariables.java:13: cannot find symbol
    symbol : variable product
    location: class DemoVariables
    product = value1 * value2;
    ^
    DemoVariables.java:13: cannot find symbol
    symbol : variable value1
    location: class DemoVariables
    product = value1 * value2;
    ^
    DemoVariables.java:13: cannot find symbol
    symbol : variable value2
    location: class DemoVariables
    product = value1 * value2;
    ^
    DemoVariables.java:14: cannot find symbol
    symbol : variable quotient
    location: class DemoVariables
    quotient = value1 / value2;
    ^
    DemoVariables.java:14: cannot find symbol
    symbol : variable value1
    location: class DemoVariables
    quotient = value1 / value2;
    ^
    DemoVariables.java:14: cannot find symbol
    symbol : variable value2
    location: class DemoVariables
    quotient = value1 / value2;
    ^
    DemoVariables.java:15: cannot find symbol
    symbol : variable modulus
    location: class DemoVariables
    modulus = value1 % value2;
    ^
    DemoVariables.java:15: cannot find symbol
    symbol : variable value1
    location: class DemoVariables
    modulus = value1 % value2;
    ^
    DemoVariables.java:15: cannot find symbol
    symbol : variable value2
    location: class DemoVariables
    modulus = value1 % value2;
    ^
    DemoVariables.java:16: cannot find symbol
    symbol : variable sum
    location: class DemoVariables
    System.out.println("Sum is " + sum);
    ^
    DemoVariables.java:17: cannot find symbol
    symbol : variable difference
    location: class DemoVariables
    System.out.println("Difference is " + difference);
    ^
    DemoVariables.java:18: cannot find symbol
    symbol : variable product
    location: class DemoVariables
    System.out.println("Product is " + product);
    ^
    DemoVariables.java:19: cannot find symbol
    symbol : variable quotient
    location: class DemoVariables
    System.out.println("Quotient is " + quotient);
    ^
    DemoVariables.java:20: cannot find symbol
    symbol : variable modulus
    location: class DemoVariables
    System.out.println("Modulus is " + modulus);
    ^
    THE SOURCE:
    public class DemoVariables
    public static void main(String[] args)
    int oneInt = 315;
    short oneShort = 23;
    long oneLong = 123456789876543L;
    System.out.println("The int is " + oneInt);
    System.out.println("The short is " + oneInt);
    System.out.println("The long is " + oneLong);
    sum = value1 + value2;
    difference = value1 - value2;
    product = value1 * value2;
    quotient = value1 / value2;
    modulus = value1 % value2;
    System.out.println("Sum is " + sum);
    System.out.println("Difference is " + difference);
    System.out.println("Product is " + product);
    System.out.println("Quotient is " + quotient);
    System.out.println("Modulus is " + modulus);
    int value1 = 43, value2 = 10, sum, difference, product, quotient, modulus;
    Can anyone tell me what I did wrong?
    Thanks...

    Similar problem
    This is the objective of my lesson: Develop a class to represents a human. The head, arms and legs should be properties of the human and should be represented by separate objects. All of your objects should have at least three properties and one method.
    public class Human
         Head human_head;
         public Human(String color1, String size1, String color2)
              human_head = new Head(color1, size1, color2);
         public static void main(String[] args)
              Human mke = new Human("green", "big", "blonde");
              System.out.println("My name is Phil I have " + mke.human_head + "eyes head hair");
    C:\java_code>javac usingobjects\Human.java
    usingobjects\Human.java:8: cannot find symbol
    symbol : class Head
    location: class usingobjects.Human
    Head human_head;
    ^
    usingobjects\Human.java:14: cannot find symbol
    symbol : class Head
    location: class usingobjects.Human
    human_head = new Head(color1, size1, color2);
    ^
    2 errors
    C:\java_code>

  • Cannot find the Symbol

    my problem is:cannot find symbol variable coefsAndDegs ; Line 54
    please help me
    import java.util.*;
    class Term {
         private int coefficient;
         private int degree;
         public Term(int coefficient, int degree) {
              this.coefficient = coefficient;
              this.degree = degree;
         public int getCoefficient() {
              return coefficient;
         public int getDegree() {
              return degree;
    public class Polynomial {
        private char polyVar;
        private ArrayList<Term> terms;
        public void Polynomial(char polyVar, int ... coefsAndDegs) {
             Scanner kb = new Scanner(System.in);
             String polies = kb.nextLine();
              polyVar = polies.charAt(0);
             if (polyVar < 'a' || polyVar > 'z') {
                  throw new IllegalArgumentException("Invalid polynomial variable.");
             } else {
                  this.polyVar = polyVar;
             // check that coefsAndDegs are provided in pairs..
             if (coefsAndDegs.length % 2 != 0) {
                  throw new IllegalArgumentException("Coefficients and Degrees must be provided in pairs.");
             } else {
                  terms = new ArrayList<Term>();
                  for (int i = 0; i < coefsAndDegs.length / 2; i++) {
                       Term term = new Term(coefsAndDegs[i * 2], coefsAndDegs[i * 2 + 1]);
                       terms.add(term);
        public void main(String[] args){
         Polynomial main = new Polynomial();
        Polynomial(polyVar, coefsAndDegs);          
    }

    bluez_exe wrote:
    my problem is:cannot find symbol variable coefsAndDegs ; Line 54And what line is that? These forums don't have line numbers, and most of us are waay too lazy to copy and paste your code into something that does.
    What do you expect this to do:
    public void main(String[] args){
         Polynomial main = new Polynomial();
         Polynomial(polyVar, coefsAndDegs);          
              }Or this:
    if (polyVar < ' || polyVar > 'z')

  • HT4437 cannot find airplay symbol in safari

    I just recently installed Apple Tv to my TV.  I am having trouble finding the airplay on my macbook pro in safari.  I can access my music and photos via my wifi connection but cannot find the airplay symbol on my laptop.

    Yeah it's annoying, any audio or video on iOS is available for AirPlay by default, but not on OS X.
    If you have a new computer, you may be able to mirror your entire Mac's display via AirPlay mirroring. Go to System Preferences, Displays, and see if AirPlay Mirroring is an option at the bottom of the window.
    The best way for the time being is to play this content from an iOS device, or find it through the Apple TV apps (if it's YouTube or Vimeo).
    Edit: You can AirPlay all your system audio by holding down Alt, pressing the volume icon in your menubar, and selecting Apple TV. This is for Mountain Lion only, and just sends all audio that would normally come from your speakers.

  • Jni findclass cannot find my own classes with jre1.4

    I have a C++ program that uses CreateJavaVM() and FindClass() to access my own Java classes. Everything works as expected. Another C++ program uses
    GetCreatedJavaVMs() (returns 1)
    AttachCurrentThread()
    FindClass()
    to try to access other Java classes of my own. The GetCreatedJavaVMs() and AttachCurrentThread() seem to work fine but the FindClass() cannot find my own Java classes anymore.
    Shouldn't the VM and associated JNIEnv from GetCreatedJavaVMs be the same as that created using CreateJavVM() and thus be able to find the same classes? By the way, this worked fine with jre1.2 but stopped working when trying to move to jre1.4. Any ideas would be appreciated.

    hi...was wondering if you got that issue resolved.
    was it actually because of the newer JRE version?
    thanks.Considering that the post is about 2 years old, and that the person hasn't posted much since then here, I'd doubt he/she's going to respond to you. This isn't his/her email address, ya know.

  • [SOLVED] LyX cannot find layout/document classes

    LyX refuses to produce any output for me because it cannot find article.layout, or any other common layout. This file is installed in /usr/share/lyx/layouts/article.layout.
    I have installed texlive-most and texlive-bin. I have installed dvips and the other programs necessary to render files.
    I have tried clearing my LyX config several times (rm -rf ~/.lyx) and it hasn't helped. I have removed and reinstalled texlive with various options, including -Rn and -Rc, multiple times. I have also manually removed leftover files from both LyX and texlive. I have told LyX to reconfigure itself several times.
    No output will be produced. I thought maybe this was caused by some stray old config file floating somewhere out there but heretofore have not been able to find it or remove it via -Rn. Someone told me that a fresh install of LyX works.
    Any help would be deeply appreciated.
    EDIT: I have also tried updating my PATH to include /opt/texlive/bin as suggested somewhere else on these boards and then running and reconfiguring LyX. It doesn't help.
    Last edited by cookiecaper (2010-08-17 17:49:20)

    Ugh, just solved it. Hopefully this helps someone. I hadn't removed ~/.texlive. Removing that and restarting LyX fixed it.

  • Cannot find file symbol not showing up

    Hi -
    I have just done a massive move and backup etc. Things are going fine - just learned that every time you "reorganized" itunes music the entire file structure changes so a real back up with something like SyncBack totally ***** but...
    The question is...
    I know that there are about 50 files that do not have the proper file association. Last night there were the little exclamation points next to the song so I could find and correct them. I closed itunes and turned the computer off for the night. And now this morning when I open up the computer and itunes I cannot tell which songs still need updating because the little exclamation points are gone. How do I get those symbols back??!! (And yes, there still are files to be corrected I test that this morning)
    Thank you anyone who can help me out with this - I hope to some day soon have a clean itunes library AND backup

    I don't think your picture has anything to do with Spotlight. My Applications folder shows up the exact same way. Mac OS X applications aren't usually a single item, they're "packages" with items and folders inside. To get folders and packages to show their size, you'll have to change the "View Options" from the View menu. Check the box on to "Calculate all sizes". I would probably change the dialog box to reflect the changes to "This window only". Otherwise the Finder will be re-calculating the size of everything in every window. That could slow things down a bit.
    -Doug

  • Cannot find the main class

    Hello,
    I am running
    Java(TM) 2 Runtime Environment, Standard Edition
    (build 1.5.0_07-b03)
    Java HotSpot(TM) Client VM
    (build 1.5.0_07-b03, mixed mode, sharing)
    on both Windows 2003 Server and Windows XP Professional.
    Whan I try to run any java program that's the message I am getting:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestJava
    On my personal computer it's running fine. I have made sure that the java program works ok. I cannot figure out why this is happening on just a few machines. I even install the SDK on those machines hoping it will allow the program to run. No luck.
    Anybody has experienced something weird like this? Any ideas?
    I need to run my java program on at least 10 machines. I have to persuade a number of folks that java is reliable. I am using java for about 3 years. I have never experienced something like that.
    Glad to provide any additional information.
    Thanks a lot.

    Something is extremely wrong here!
    Let's forget about the classmates for a sec and the jar directories
    Let me go to the basics here:
    I installed Java 1.5.0_07-b03 on my Windows 2003 server.
    In command prompt, when I run java -version I am getting:
    java version "1.5.0_07"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
    When I just type java I am getting:
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    etc.
    To me that tells me java (JRE) is up and running. I should be able to run a program as easy as
    public class TestJava {
    public static void main(String Args[]){
    System.out.println("Success");
    after I compile it as such
    javac TestJava.java
    without getting any errors.
    However when I run
    java TestJava
    I am getting
    Exception in thread "main" java.lang.NoClassDefFoundError: TestJava
    I am in the same directory where the TestJava.class exists.
    Something so simple and it does not work. That's what drives me crazy.
    Any other test you might suggest?
    Thanks a lot.

  • Help!! cannot find files outside class dir

    Directory Structure:
    App
    |-src
    |-classes
    | |-App
    | |-...Packages
    |-resource
    |- images
    I am having problems finding the files in the resource directory from the classes in the classes directory.
    Currently, I am trying:
    InputStream is = ClassLoader.getSystemResourceAsStream("app.properties");
    and running with: java -cp .;../resource App.MainClass
    whats wrong? and Is it different if I use a JAR file?

    I can only get it working if the "resource" directory is in amongst the packages
    App
    |- classes
    | |- App
    | �  |.. packages
    | �  |- resource
    |- src
    and use :
    InputStream is = ClassLoader.getSystemResourceAsStream("App/resource/app.properties");

  • Play To - DLNA app questions - cannot find/broadca...

    Hi all,
    Anybody using the new Play To app?
    As I understood from the whole thing, it - should- be easy to show stuff from your phone on a DLNA TV.
    I've tried to connect to my TV and/or BR player (both certified) but no go.
    I added the MAC adresses of the TV and BR player to the wifi router list, but they just don't show.
    I can find my PC if I turn media sharing on, and can show pics of my phone on the PC screen in MediaPlayer, so the software on the phone works.
    It's just not connecting to the TV or BR player, so what does one to do to get this working? Wifi settings and all.
    Before I forget, both TV and BR player are also connected to the router by ethernet cable.
    cheers,
    rob

    Line Play Support Team says:
    We regret to tell you that service for LINE PLAY has been suspended temporarily in some areas since June 27, 2014 (GMT+9).
    We have been attempting to organize various events and improve our operations and systems since the LINE PLAY service started.
    However, we decided to suspend the service of LINE PLAY temporarily in order to make an overall improvement for future developments.
    We are also aware that some customers are still able to use LINE PLAY even though service has been suspended in their area.
    These customers may be experiencing the following problems.
    - Some of the features on LINE PLAY are not working properly.
    - Gems and Extra Hearts cannot be purchased.
    - The app cannot be updated.
    We are currently working our hardest on the improvement process.
    As soon as it is completed, we will resume providing the LINE PLAY service.
    We deeply apologize that we could not inform you of the temporary suspension of the LINE PLAY service in advance, and for causing confusion among our users.
    We would like to ask for your understanding and patience.
    Thank you for using our services, and please let us know if you need any additional assistance.

  • Newbie Question: Rules: Functions: How to compare String based type?

    I have some XML facts in my rules dictionary defined by the following schema (fragments shown)
    <xs:simpleType name="VarType">
       <xs:restriction base="xs:string">
          <xs:enumeration value="Foo"/>
          <xs:enumeration value="Bar"/>
          <xs:enumeration value="Baz"/>
          <xs:enumeration value="Qux"/>
       </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="ProgType">
       <xs:sequence>
          <xs:element name="ID" type="xs:string"/>
          <xs:element name="var" type="VarType" maxOccurs="unbounded"/>
       </xs:sequence>
    </xs:complexType>
    Which means that a Prog of ProgType has an ID and a "list" of "var" strings restricted to bounds specified by VarType.
    The issue comes when I try to create a Rules Function operating on these types.
    Function-> boolean containsVar(ProgType prog,VarType var) (built using the Functions tab of the Rules editor)
    for (String v : prog.var ){
       if (v == var){
          return true
    return false
    The problem we run into here is typing. If v is declared a String, as here, then v == var is invalid because types don't match. But I can't declare v a VarType due to
    RUL-05583: a primitive type or fact type is expected, but neither can be found.
    This problem may stem from the fact the Java's String is declared final and can't be subclassed, so the JAXB translation to Java may have to wrap it, futzing ==/equals() in the process.
    SO... How do I create this method and compare these values?
    TIA
    Edited by: wylderbeast on Mar 10, 2011 9:15 AM - typos
    Edited by: wylderbeast on Mar 10, 2011 9:18 AM

    And here's the answer.
    var.value() seems to return the String value of the type
    so the comparison becomes
    (v == var.value())
    Live and learn....

  • Newbie question for LogOn trigger and Connection String

    Hi,
    I would like to set certain session variables in the logon trigger. Is there a connection string attribute or some other way to pass a string or some data to the session.
    regards
    Stefan

    Hi,
    my concrete problem is that our application only uses one user. eg. appuser . During the login process of the application the "real" user name, language and other attributes are set in a packag as global variables.
    This works fine, but as soon as a usr logs on the DB without our application login then these are ofcourse not filled. My idea was to maybe to be able to enhance the connection string and to be able to pass some more information to the logon trigger.
    regards
    Stefan

  • Newbie Question - Cannot log onto htmldb admin user after new v2 install

    Hi
    Cannot log onto admin user.
    htmldb v2 - installed fine on db
    Oracle Server - 9.2.0.5
    9i Application Server (httpd 1.0.2.2.2). This part of the ebso 11.5.10 stack. Many
    reasons why i had to do this but i could not see a compat issue ? This is only
    test bed as well, not a production configuration.
    Followed all v2 post-install tasks - httpd.conf/wdbsvr.app .
    DAD/modplsql config OK.
    On connection to admin interface - host:port/pls/htmldb/htmldb_admin, gives what i would call the 'standard' browser logon page ? Not the htmldb logon template
    Thought it may be issue with images alias but don't really know and cannot see issue with config files ?
    Regards
    A

    Do you have an alias setup for the images directory? For example -
    Alias /i/ "....path to images directory..."If not, then that's probably the cause of your problem. If you do have that entry, then check that the path is correct, and check that the permissions on that directory are such that the user that the webserver is running as can access the directory.

  • Mac Newbie Question:  Cannot save file?

    I'm a new Mac user.
    I'm running Snow Leopard on MacBook Pro machine.
    I'm logged in under my administrator account.
    When i try to save an edit i made to Apache's httpd.conf file using TextEdit.app, I get an error message simply saying that the file cannot be saved and that i do not have write permission to do so.
    How does one use a text editor in Mac Os X to make such config edits and authenticate the action?
    Thanks.

    Get a copy of [TextWrangler|http://www.barebones.com/products/TextWrangler>. It's free, and it'll take care of authenticating for you.

Maybe you are looking for

  • How do I get the remote control app to work for a Sony HDD Hi Res audio player?

    Can't get the iPhone remote control app to work for my HDD Hi Res Audio player.  The app can "find" the player and I can turn on the power with the app but then can't get it to go to my music - can only use the "demo" tool with the demo info. What am

  • CFLOGIN not maintaining cfauthrization session variable

    I have a simple CF web site where all of the .cfm is in the same directory. I can not use client cookies as the people I am writing this for have cookies turned off in IE, therefore I am using J2EE session variables and CFLOGIN in an application.cfm

  • I brought a macbook pro retina, what type of warranty is better

    i brought a macbook pro retina, what type of warranty is better

  • Dynamic LOV (Where Clause Issue)

    I have a LOV on an item that I want to be dynimac based on a transaction date field. When I hard-code the date, it works fine (or use sysdate). select ft.ftvacct_acct_code || '-' || ft.ftvacct_title || '-' || ft.ftvacct_atyp_code display_value , ft.F

  • Customizing XMLP Server Header

    Hi I saw a posting about this a few months back with little response. In XML Publisher Standalone 5.6.2, we need to customize the 'Look' of the Reportserver. Basically adding in some customer logos, etc. Is this possible? If so, how would you go abou