CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2011
    Posts
    5

    please help ..!! its a minor error

    hey everyone...i was compiling a project code...

    but it is having a very small error..please take a look and help me...

    its a sincere request...
    Attached Files Attached Files

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: please help ..!! its a minor error

    Post the relevant code in code tags and post the compiler message(s) and I'll look at it for you..
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Nov 2011
    Posts
    5

    Re: please help ..!! its a minor error

    Quote Originally Posted by keang View Post
    Post the relevant code in code tags and post the compiler message(s) and I'll look at it for you..
    hey keang,
    thanks for showing interest.

    Code:
    package encryptionproject;
    
    import java.applet.Applet;
    import java.awt.*;
    
    public class EncryptionProject extends Applet
    {
    
        public EncryptionProject()
        {
        }
    
        public static void main(String args[])
        {
            EncryptionProjectPanel encryptionprojectpanel = new EncryptionProjectPanel();
            Frame frame = new Frame();
            _cls1 _lcls1 = new  Object()     /* anonymous class not found*/
        class _anm1 {}
    
    ;
            frame.addWindowListener(_lcls1);
            frame.add(encryptionprojectpanel);
            frame.setLocation(200, 200);
            frame.pack();
            frame.setVisible(true);
        }
    
        public void init()
        {
            EncryptionProjectPanel encryptionprojectpanel = new EncryptionProjectPanel();
            setBackground(Color.lightGray);
            add(encryptionprojectpanel);
        }
    
        public static final Font MONOSPACE_FONT = new Font("Monospaced", 0, 12);
        public static final Font MONOSPACE_LARGE_FONT = new Font("Monospaced", 0, 14);
        public static final Font CODE_FONT = new Font("Monospaced", 0, 10);
    
    }
    OUTPUT:
    run:
    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
    symbol: class _cls1
    location: class encryptionproject.EncryptionProject
    at encryptionproject.EncryptionProject.main(EncryptionProject.java:17)
    Java Result: 1


    as in _cls1 is an undefined class and when i replace it with object it say unmatched allocation.

  4. #4
    Join Date
    Nov 2011
    Posts
    5

    Re: please help ..!! its a minor error

    i have the same error at 3 different places in the project.

    mayb if you compile the project i attached, it'll help you.

    please help me..

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: please help ..!! its a minor error

    I think you need to explain what you were trying to do when you wrote the line:
    Code:
           _cls1 _lcls1 = new  Object()     /* anonymous class not found*/
        class _anm1 {}
    
    ;
    This isn't legal Java - you don't declare anonymous classes like this if that's what you were trying to do. Also the compiler is saying there is no class called _cls1 on the classpath so the declaration of variable _lcls1 is not valid.

    BTW You should use Java naming standards (eg Class name start with a capital letter etc) as it makes the code so much easier for other people (eg me) to read.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  6. #6
    Join Date
    Nov 2011
    Posts
    5

    Re: please help ..!! its a minor error

    Quote Originally Posted by keang View Post
    I think you need to explain what you were trying to do when you wrote the line:
    Code:
           _cls1 _lcls1 = new  Object()     /* anonymous class not found*/
        class _anm1 {}
    
    ;
    This isn't legal Java - you don't declare anonymous classes like this if that's what you were trying to do. Also the compiler is saying there is no class called _cls1 on the classpath so the declaration of variable _lcls1 is not valid.

    BTW You should use Java naming standards (eg Class name start with a capital letter etc) as it makes the code so much easier for other people (eg me) to read.
    actually i got this code by decompiling several class file.

    i plan to extend this project so i thought of decompiling the class file and then work on it.

    http://www.levidsmith.com/gitcommand...onProject.html

    this is the applet of the original code.

    the code i got is by decompling all the class files of this applet. so technically it should have no errors..!!:/

  7. #7
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: please help ..!! its a minor error

    the code i got is by decompling all the class files of this applet. so technically it should have no errors..!!:/
    Decompilers can often struggle to successfully decompile anonymous inner classes.

    Can't you get the original source?
    Do you have the legal right to decompile this code, doing this often breaches the license it is issued under.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  8. #8
    Join Date
    Nov 2011
    Posts
    5

    Re: please help ..!! its a minor error

    I tried contacting the owner..but he was out of reach..

    is there a way that we can build this applet without the anonymous class..i haven't used anonymous class ever, so i am a bit confused how it helps in this code.

    and its only in the UI so could we write a new UI code and make it work?

  9. #9
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: please help ..!! its a minor error

    is there a way that we can build this applet without the anonymous class
    Yes, if you can work out what the anonymous class does you can rewrite it as top level class.

    Unfortunately, I can't help you do this unless I'm confident you aren't infringing someone's license.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured