My first Java compile error!

I'm not new to programming but I am to Java, I like it so far and I know I have a long way to go.
I just started an online training course in Java and the second
program to write was this:
import java.awt.Frame;
import java.awt.Label;
public class HowdyWindow extends Frame {
public static void main(String args[]) {
new HowdyWindow();
HowdyWindow() { 
Label label;
label = new Label("Howdy!");
add(label);
pack();
show();
I then compiled it and was met with this ugly statement:
Note: HowdyWindow.java uses or overrides a depricated API.
Note: Recompile with Xlint:deprecation for details
Did that, got this:
HowdyWindow.java:13 Warning:[serial] Serializable class HowdyWindow has no definition of serialVersionUID
public class HowdyWindow extends Frame {
2 warnings
As a newbie I have no clue, How could I ?
Please someone tell me what to do next, in Newbie terminology?

are they both warnings? errors you have to fix; warnings should be corrected eventually, but you can get by for now.
this is happening because the show() method is deprecated. you should use setVisible(true) instead. look at the javadocs and see what's what.
did you get a HowdyWindow.class file? if so, execute it and see what happens.
%

Similar Messages

  • Redirecting java compilation errors to a file

    Hi,
    How do I redirect java compilation errors to a file while using a dos environment ? Help needed asap.
    Gayathri

    javac FileName.java 2> errorFileName

  • Java compile error for removed API

    Hi,
    What are the Java compile errors for API that has been removed?
    As I understand it, API elements are deprecated and not removed from the API immediately, but will be removed in future releases or after so many years.
    When Java code is compliled in a higher Java version, and the API has finally been removed - what are the errors that will be ouput in the log?
    Thank you for your time.

    WalterLaan wrote:
    And if you recompile one with a method removed that the other use and then run the other you would get a NoSuchMethodError (or more generally just an error sub class of LinkageError).
    Not that you should be catching those unless you accept classes from the user (as plugins).Presumably you mean he should not be catching them?
    @OP: In general, you should not catch unchecked exceptions. These are RuntimeException, Error, and their descendants. There are exceptions, such as at "layer boundaries," or when you don't want errors in one module/application/plugin/etc. to affect or prevent processing in others.

  • Java compilation error messages

    Is there any way for HTML DB to return error messages during Java compilation? Every create java command I submit -- unless there is a grievous syntax error -- seems to return statement processed:
    Given....
    CREATE OR REPLACE FUNCTION returnOne
       RETURN NUMBER
    AS LANGUAGE JAVA
       NAME 'JavaTest.returnOne ()
                return int';Test #1 -- a valid Java source code:
    create or replace java source named "JavaTest" as
    public class JavaTest
      public static int returnOne()
           return 1;
    Statement processed.
    0.20 seconds
    begin
      htp.p(returnOne());
    end;
    1
    Statement processed.
    0.11 secondsTest #2 -- Invalid source code -- there is no indication until runtime that anything is wrong:
    create or replace java source named "JavaTest" as
    public class JavaTest
      public static int returnOne()
           iCalendar ical   = new iCalendar();
           return 1;
    Statement processed.
    0.18 seconds
    begin
      htp.p(returnOne());
    end;
    ORA-29541: class ARDB.JavaTest could not be resolved
    0.37 seconds               :(

    Er....yeah....but do you have any idea why the SQL Command Processor would not return any errors when trying to compile a class with a non-valid dependency?
    Another example:
    create or replace and compile java source named "JavaTest" as
    public class JavaTest
      public static int returnOne()
           MyFooBarClass ns = new MyFooBarClass();
           return 1;
    Statement processed.
    0.37 seconds
    select * from user_errors where name = 'JavaTest';
    NAME     TYPE     SEQUENCE     LINE     POSITION     TEXT     ATTRIBUTE     MESSAGE_NUMBER
    JavaTest     JAVA CLASS     1     0     0     ORA-29535: source requires recompilation     ERROR     0
    JavaTest     JAVA SOURCE     1     0     0     JavaTest:5: cannot resolve symbol     ERROR     0
    JavaTest     JAVA SOURCE     2     0     0     symbol : class MyFooBarClass      ERROR     0
    JavaTest     JAVA SOURCE     3     0     0     location: class JavaTest     ERROR     0
    JavaTest     JAVA SOURCE     4     0     0     MyFooBarClass ns = new MyFooBarClass();     ERROR     0
    JavaTest     JAVA SOURCE     5     0     0     ^     ERROR     0
    JavaTest     JAVA SOURCE     6     0     0     JavaTest:5: cannot resolve symbol     ERROR     0
    JavaTest     JAVA SOURCE     7     0     0     symbol : class MyFooBarClass      ERROR     0
    JavaTest     JAVA SOURCE     8     0     0     location: class JavaTest     ERROR     0
    JavaTest     JAVA SOURCE     9     0     0     MyFooBarClass ns = new MyFooBarClass();     ERROR     0
    JavaTest     JAVA SOURCE     10     0     0     ^     ERROR     0
    JavaTest     JAVA SOURCE     11     0     0     2 errors     ERROR     0Well, now that I know about user_errors, I can go ahead -- but that was sort of a surprising find.....

  • I created my first program-compiling error-help please

    hey there
    i just wanted my first program in java and here it is below with the eroor when i'm compiling it, i cant understand whats wrong:
    public class SquareArea {
         public static void main(String[] args); {
         float length;
         float width;
         float SquareArea;
         System.out.println ("Please enter length"+ length);
         System.out.println ("Please enter width"+ width);
         SquareArea= length*width;
         System.out.println ("The area of the square is" + SquareArea);
    The error is:C:\Documents and Settings\User\Desktop\SquareArea.java:5: missing method body, or declare abstract
         public static void main(String[] args); {
    ^
    1 error
    Tool completed with exit code 1

    There shouldn't be a semicolon between the ")" and the "{" near the end of that line.
    With that semicolon, you're basically defining an empty, zero-size main method, and then throwing a bunch of garbage after it. That's what the compiler thinks anyway. Remove that semicolon and it should compile OK.
    But it won't work super well, because you're not actually getting any input for length and width. It's just going to output this:
    Please enter length0
    Please enter width0
    The area of the square is0

  • Java compilation error in Web Dynpro

    Hi Experts,
    I have to write one line like this in Java program of Web Dynpro:
    wdContext.currentPritemElement().setPreq_Price("1.544");
    This is not getting compiled. The error is "The method setPreq_Price(BigDecimal) in the type IPrivateMyView.IPritemElement not applicable for arguments(string)".
    It looks like there is datatype mismatch and due to this we are getting above error. We Can we do some like typecasting etc to sort out the issue. If yes, how we can do so.
    Regards,
    Ravindra

    Hi Ravindra,
    The error is because of data type mismatch.
    You can do like this:
    wdContext.currentPritemElement().setPreq_Price(new BigDecimal(1234));
    Thanks.
    Best Regards,
    Shiva

  • Java compile error

    hi
    im currently running java 1.4.2 on ubuntu linux.
    i can compile and run my simple one class programs without any probs.
    recently i have tried to compile a class which uses objects defined in other classes in the same directory and it wont compile. it has problems with any objects not defined in that particular class. error message says object cannot be resolved to a type.
    any help here would be appreciated
    thanks
    Edit/Delete Message

    Bone up on packages, classpath and how to compile. http://www.jarticles.com/package/package_eng.html
    - Saish

  • Java Compilation error.

    Trying to compile java file and got following error. Java version I am using is 1.4.2. I tried to comple same with
    -source 1.3 option also but not luck. Any help would be appriciated.
    DataBrokerClass.java:963: cannot resolve symbol
    symbol : method getArray (java.util.Map)
    location: class oracle.sql.ARRAY
    Object[] AdvoIntCfgHhcRecObj = (Object[]) advointCfgHhcRecArrOut.getArray(map);
    ^
    Note: DataBrokerClass.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details.
    1 error

    it has nothing to do with the java version or java itself really, you are trying to call a method that does not exist. I am not the worst person on earth, so I did some investigating on the net. It turns out that you are incorrectly using a Map, you want to use a Hashtable in stead.
    Just for reference, what I did to investigate is, I typed "oracle.sql.ARRAY" into google and that gave me the javadocs for this class.

  • Java Compile Error  Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 14  for iOS

    When compiling one of my projects, I am getting this error suddenly:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 14
              at adobe.abc.GlobalOptimizer$InputAbc.readCode(GlobalOptimizer.java:1510)
              at adobe.abc.GlobalOptimizer$InputAbc.readBody(GlobalOptimizer.java:682)
              at adobe.abc.GlobalOptimizer$InputAbc.readBodies(GlobalOptimizer.java:403)
              at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:326)
              at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcodeImpl(AOTCompiler.java:472)
              at com.adobe.air.ipa.BitcodeGenerator.main(BitcodeGenerator.java:82)
    Compilation failed while executing : ADT
    but only when targeting iOS. fo Android only, it works fine. Anyone have any ideas? I also logged it as a bug.

    I get the I/O exception while reading: D:\Java\HelloApplet (The system cannot find the file specified). I have previously compiled HelloApplet.java into HelloApplet.class using javac.exe
    the two include statements in the sample HelloApplet I'm using are
    import java.applet.*;
    import java.awt.*;
    I also have a ComponentEventTest.java file which I've made into a class with these two
    include statements:
    import java.awt.*;
    import java.awt.event.*;
    I can however compile .java files which have no include statements.
    I take it that my classpath is not set correctly. Like I said earlier, I'm using winxp
    and trying to set the classpath variable under system. I have tried under user too. The path names I've tried setting are C:\Program Files\Java\jdk1.5.0_02\, C:\Program Files\Java\jdk1.5.0_02\lib, C:\Program Files\Java\jdk1.5.0_02\include, and C:\Program Files\Java\jdk1.5.0_02\;C:\Program Files\Java\jdk1.5.0_02\lib;C:\Program Files\Java\jdk1.5.0_02\include.
    How can I correct this? If it's possible, I would like to set a variable in windows
    versus having to type extra commands at the command prompt everytime I try
    to run a java class with java.exe. Any help would be much appreciated

  • Xcode Java Compilation Error

    Hello Everyone,
    I am using XCode to develop a Java application. I created my main file and a bunch of other files (object oriented) that help out the main file by selecting Add > File & then choosing pure Java file.
    When I run Build, they all compile just fine. However, when I create an object in the main file from a java class I wrote, it throws an error. For example
    class A
    Main()
    create object B
    //seperate file called b.java
    class B
    constructor()
    some variables
    Class A is not able to see Class B. Also, I was not able to see to my other files. Any ideas how I can fix this? I have been coding for a long time, but on Linux. I just started my transition to Mac. Thanks.
    Message was edited by: krazykoder

    I figured it out.
    Closing topic.

  • Java Compiler Error Export

    Is there anyway to export the error results as a txt file when we compile java program in Windows XP CommandPrombt?

    You can use System.setOut() and System.setErr() methods within Java, or you can use Windows' redirection capabilities (hint: see Windows Help for "redirect output".)

  • Fetch Document from workspace+java API+ObjectByPath.java compile error

    Hi All,
    (Hyo version: 11.1.1.3)
    I was trying to export files imported into workspace. For testing purpose I imported P4S.pdf in 'Sample Content' folder.
    While looking for various options I came across Java API for workspace.(See samples in C:\Hyperion\products\Foundation\workspace\SDK\samples\java)
    I found a Java sample named "ObjectByPath.java". I complied (using JC.bat) and executed (with Execapi.bat) and came with this output:
    C:\Hyperion\products\Foundation\workspace\SDK\bin>execapi ObjectByPath admin password localhost 6800 "Sample Content/P4S.pdf"
    library not available, add it to your classpath: spf.jar
    Path : Sample Content/P4S.pdf
    Name : P4S.pdf
    Path : /Sample Content/P4S.pdf
    Mime Type: application/pdf
    Class : com.sqribe.rm.DataObjectImpl
    ObjectID : 0000013828cfc4b7-0000-a30d-7f000001
    Unfortunately the object could not be exported. I checked the "ObjectByPath.java" file and I saw:
    String path = args[4];
    RMBase tObject = rep.getObjectByPath(path);
    // tObject.toXML(System.out);
    System.out.println("Path : " + path);
    if (tObject instanceof BaseObject) {
    BaseObject baseObj = (BaseObject) tObject;
    System.out.println("Name : " + baseObj.getName());
    System.out.println("Path : " + baseObj.getPath());
    System.out.println("Mime Type: " + baseObj.getObjectType().getMimeType());
    System.out.println( "Class : " + tObject.getClass().getName());
    System.out.println( "ObjectID : " + tObject.getObjectID());
    Note that the exported line is commented.
    When I remove the comment and recomplile with JC.bat I get this error:
    C:\Hyperion\products\Foundation\workspace\SDK\bin>jc ObjectByPath.java
    ObjectByPath.java:32: unreported exception java.io.IOException; must be caught or declared to be thrown
    tObject.toXML(System.out);
    ^
    Note: ObjectByPath.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    1 error
    Any idea how to resolve this issue.
    Thanks,
    Ankit

    It says to add spf.jar to your classpath. Can you do a search on the file system for that file? If you find it add to your classpath.
    By commenting that line out you just produced another, unrelated error.
    Thanks
    Nick

  • JMStudio.java compilation errors.

    Someone understand these error below ? >>>
    Thanks.
    JMStudio.java:1452: warning: [unchecked] unchecked call to addElement(E) as a me mber of the raw type java.util.Vector
    vectorFrames.addElement ( jmStudio );
    ^
    JMStudio.java:56: warning: [serial] serializable class JMStudio has no definitio n of serialVersionUID
    public class JMStudio extends PlayerFrame implements ItemListener,
    ^
    11 warnings
    Message was edited by:
    DEV_FORUM_Screen

    javac FileName.java 2> errorFileName

  • Error in Java compilation: \s7u.log (The system cannot find the file specified)

    Hi there,
    I got an error when I tried to compile a group of sqlj and java files. The error below:
    ----------------------------------------------sqlj -status -passes -compile=true -ser2class -d=. -classpath=.;%CLASSPATH% E:\work\src\java\com\interadnet\persistence\*.sqlj E:\work\src\java\com\interadnet\persistence\*.java
    out [Translating 53 files]
    out [Reading file AdServerInformationType]
    out [Reading file AdsType]
    out [Reading file AgencyType]
    out [Reading file CampaigntocompletionType]
    out [Reading file CampaignType]
    out [Reading file ChannelType]
    out [Reading file ClientType]
    out [Reading file CompletionType]
    out [Reading file ContactType]
    out [Reading file CreativeType]
    out [Reading file FtpServerType]
    out [Reading file InsertioninstructionType]
    out [Reading file MediaServerType]
    out [Reading file SystemPropertyType]
    out [Reading file VendorType]
    out [Reading file AdServerInformationTypeRef]
    out [Reading file AdServerInformationView]
    out [Reading file AdsTypeRef]
    out [Reading file AdsView]
    out [Reading file AgencyTypeRef]
    out [Reading file AgencyView]
    out [Reading file CampaigntocompletionTypeRef]
    out [Reading file CampaignToCompletionView]
    out [Reading file CampaignTypeRef]
    out [Reading file CampaignTypeRefs]
    out [Reading file CampaignView]
    out [Reading file ChannelTypeRef]
    out [Reading file ChannelTypeRefs]
    out [Reading file ChannelView]
    out [Reading file ClientTypeRef]
    out [Reading file ClientTypeRefs]
    out [Reading file ClientView]
    out [Reading file CompletionTypeRef]
    out [Reading file CompletionTypeRefs]
    out [Reading file CompletionView]
    out [Reading file ContactTypeRef]
    out [Reading file ContactView]
    out [Reading file CreativeTypeRef]
    out [Reading file CreativeTypeRefs]
    out [Reading file CreativeView]
    out [Reading file FtpServerTypeRef]
    out [Reading file FtpServerView]
    out [Reading file InsertioninstructionTypeRef]
    out [Reading file InsertioninstructionTypeRefs]
    out [Reading file InsertionInstructionView]
    out [Reading file MediaServerTypeRef]
    out [Reading file MediaServerView]
    out [Reading file SystemPropertyTypeRef]
    out [Reading file SystemPropertyTypeRefs]
    out [Reading file SystemPropertyView]
    out [Reading file VendorTypeRef]
    out [Reading file VendorTypeRefs]
    out [Reading file VendorView]
    out [Translating file AdServerInformationType]
    out [Translating file AdsType]
    out [Translating file AgencyType]
    out [Translating file CampaigntocompletionType]
    out [Translating file CampaignType]
    out [Translating file ChannelType]
    out [Translating file ClientType]
    out [Translating file CompletionType]
    out [Translating file ContactType]
    out [Translating file CreativeType]
    out [Translating file FtpServerType]
    out [Translating file InsertioninstructionType]
    out [Translating file MediaServerType]
    out [Translating file SystemPropertyType]
    out [Translating file VendorType]
    out [Translating file AdServerInformationTypeRef]
    out [Translating file AdServerInformationView]
    out [Translating file AdsTypeRef]
    out [Translating file AdsView]
    out [Translating file AgencyTypeRef]
    out [Translating file AgencyView]
    out [Translating file CampaigntocompletionTypeRef]
    out [Translating file CampaignToCompletionView]
    out [Translating file CampaignTypeRef]
    out [Translating file CampaignTypeRefs]
    out [Translating file CampaignView]
    out [Translating file ChannelTypeRef]
    out [Translating file ChannelTypeRefs]
    out [Translating file ChannelView]
    out [Translating file ClientTypeRef]
    out [Translating file ClientTypeRefs]
    out [Translating file ClientView]
    out [Translating file CompletionTypeRef]
    out [Translating file CompletionTypeRefs]
    out [Translating file CompletionView]
    out [Translating file ContactTypeRef]
    out [Translating file ContactView]
    out [Translating file CreativeTypeRef]
    out [Translating file CreativeTypeRefs]
    out [Translating file CreativeView]
    out [Translating file FtpServerTypeRef]
    out [Translating file FtpServerView]
    out [Translating file InsertioninstructionTypeRef]
    out [Translating file InsertioninstructionTypeRefs]
    out [Translating file InsertionInstructionView]
    out [Translating file MediaServerTypeRef]
    out [Translating file MediaServerView]
    out [Translating file SystemPropertyTypeRef]
    out [Translating file SystemPropertyTypeRefs]
    out [Translating file SystemPropertyView]
    out [Translating file VendorTypeRef]
    out [Translating file VendorTypeRefs]
    out [Translating file VendorView]
    out [Compiling 53 Java files]
    err*** The following character string is too long:
    err***
    out Error in Java compilation: \s7u.log (The system cannot find the file specified)
    Any suggestion appreciated.
    Daniel Huang

    Having not seen this before, I assume that the issue is that the command line string is too long when Javac is invoked.
    Here are a few things to reduce the size of the command line:
    - do not use the CLASSPATH option, but set the CLASSPATH environment variable (you can to that in a .bat file)
    - do not provide the .java files but rely on the implicit make capability in both, the SQLJ translator and the Java compiler. (Note: you must mention all of the .sqlj files that your program requires, do not rely on implicit make to find all of those.)
    - you can perform the -ser2class conversion as a separate step (see the SQLJ FAQ), as well as the Java compilation
    - there may or may not be a facility in your operating system to increase the size of the environment (and this may or may not have an effect on the maximum command line length)
    - you could try to omit the -passes option and see if that helps (that may actually be where your invocation if failing in the first place, in that it cannot write to some temporary file).
    Let us know how it goes. Thanks!

  • Exception in thread "main" java.lang.Error: Unresolved compilation problem

    The following code:
         public boolean find(MusbachJ_Person person,BstNode node)
              //p.l(person);p.l(node.intData);
              if(node.intData.compareTo(person)==0)
                   return true;
              if( node.leftNode != null ) find(person,node.leftNode );
              if( node.rightNode != null ) find( person, node.rightNode);
              else
                   return false;
         }returns the following compilation error:
    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
         This method must return a result of type boolean
         at MusbachJ_TreeNode.find(MusbachJ_TreeNode.java:32)
         at MusbachJ_PeopleTree.main(MusbachJ_PeopleTree.java:91)
    But I don't understand, the else statement is right there, what more does it want? Thanks! :)

    John_Musbach wrote:
    Exception in thread "main" java.lang.Error: Unresolved compilation problem: Unresolved compilation problem is an error that you'll only ever see if you're using an IDE. If you used the javac compiler, then you would have seen that the code doesn't even compile.
    The reason (as others have pointed out) is, that some paths through your method don't return a value.
    I'll re-write your code in the code-style that I usually use, because then it might be easier for you to see the problem:
    public boolean find(MusbachJ_Person person,BstNode node)
         if(node.intData.compareTo(person)==0) {
              return true;
         if( node.leftNode != null ) {
              find(person,node.leftNode );
         if( node.rightNode != null ) {
              find( person, node.rightNode);
         else {
              return false;
    }There are two prolbems. I'll spell out the first and let the other one for you to find:
    1.) you don't do anything with the return-values of the find-methods you are calling. What do you want to do with them?
    2.) What do you return if the current node is not the one that you want and you've got a right node?

Maybe you are looking for

  • Calling a method by a button

    Hy outthere, does anyone know how to call a method in my bean by clicking a button It's purpose is deleting an item in a Guestbook. i imagined somethin like that: <Input type="button" onclick="<% guestbook.deleteItem(); %>"> Or is it a completly diff

  • BP Report

    Dear All, Please if anyone know transaction for BP report and also how to Know who is the user that created the BP. Best Regards, Khairy Soliman

  • Rsh in solaris

    hi guys we have moved our apps and db servers physically my solaris admin had earlier made a shell script for daily backup of prod system. since we have 2 node configuration,he is calling the second node from 1 st node to stop the apps services. howe

  • Charging 2 iPads together?

    Hi Is there anything on the market that will allow you to charge 2 iPads or iPad and iPhone at the same time - have looked on the apple store hoping to see a USB charger with 2 ports but there doesn't seem to be one. Thanks

  • Activities Generation using transaction template???

    Good day Gurus!! Really need your help! I'm trying to generate list of activities for specific Target Group of business partners. Also I need that generated activities would have PLANNED DATE from business partner master data (visiting hours). E.g. I