Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

problems running JBuilder 9.

  • 11-12-2003 3:54pm
    #1
    Registered Users, Registered Users 2 Posts: 383 ✭✭


    Hi,

    can any one help me setting up JBuilder 9. Every time I try run a basic applet I get the following error,
    java.lang.NoSuchMethodError: main

    Exception in thread "main"

    Its JBuilder 9 (Personal), I just installed it, so it may be a setup/configuration problem.

    Any suggestions?


Comments

  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    Also, an error message I get when trying to run the applet: "Could not find the main method: Program will exit!"


  • Registered Users, Registered Users 2 Posts: 6,334 ✭✭✭OfflerCrocGod


    Does your code actually run?, is that a compilation error?, if your not sure just compile it from the cmd line and see if can then run it in a browser.


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    I have no idea if the code runs, it should though it just a basic empty applet.

    The personal edition does not have command line compiling/building.

    Here is a screeny of my error,
    error.JPG


  • Registered Users, Registered Users 2 Posts: 2,695 ✭✭✭Darwin


    Hi,
    JBuilder is expecting an application with a static method main. Instead you
    are trying to directly execute an applet which runs inside a browser.
    If you create a basic html file for your applet and add that file to your project,
    you can view the output from the applet by simply selecting the html file.
    Something very simple like this should get you started:
    <HTML>
    <BODY>
    <APPLET CODE="MyApplet.class" /APPLET>
    </BODY>
    </HTML>
    Save this as a HTML file in the same folder as "MyApplet.class"
    Alternatively, you can use the appletviewer utility to load the web page and
    create an instance of the applet. From the Windows command line type:
    appletviewer MyApplet.html
    Make sure the appet class is in the same folder. Also make sure you have set up
    the path to the JDK bin directory, e.g.
    PATH=%PATH%;c:\jbuilder9\jdk1.Version number here\bin


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    This is the HTML that JBuilder creates (its in the Applet1.html file)
    <html>
    <head>
    <title>
    HTML Test Page
    </title>
    </head>
    <body>
    untitled1.Applet1 will appear below in a Java enabled browser.<br>
    <applet
      codebase = "."
      code     = "untitled1.Applet1.class"
      name     = "TestApplet"
      width    = "400"
      height   = "300"
      hspace   = "0"
      vspace   = "0"
      align    = "middle"
    >
    </applet>
    </body>
    </html>
    
    When I view it through IE it does not show any thing (a textarea should show in the applet saying "Hello World"), the status bar doesn't indicate any errors either.

    This exact same applet works fine on the computers in college though! Which is why I think its a config problem, so global setting perhaps?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,695 ✭✭✭Darwin


    I'm quite sure this is not a configuration problem - I refer back to my original point -
    you cannot directly execute an applet by choosing the Run command within
    the JBuilder environment.
    I note from your screenshot that the applet source is in a directory 'untitled1a'
    However, the code attribute in your HTML file references:
    "untitled1.Applet1.class"
    This indicates the class file for Applet1 belongs to a package 'untitled1'
    and so should be placed in a corresponding folder named untitled1
    I think this is the source of your problems.


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    I have tried putting the .html file into the same folder as the .class file as well as every other folder in the directory.

    In every other folder, an error is displayed in the status bar, unable to load or something like that, in the folder with the .class file it doesn't display any thing.

    Any other ideas?


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    This is a notorious problem....

    Best thing to do is....

    Remove the line at the top of the program that says "package untitled1" - that's just gonna cause unnecessary headaches. Recompile.

    Now create a brand new Folder. In this folder put a HTML file, like the one Darwin gave you, and a copy of "Applet1.class".

    Then view the HTML file. It *should* work. If it doesn't, have a look at another web page with a working applet. Check to see if your <applet> tags are missing anything, as that always seemed to be the problem for me.

    You also need to make sure you have the Java plugin for IE, and that it's as up-to-date as the compiler you use in JBuilder.


Advertisement