Current Position:Home > Need help getting my applet to run..

Need help getting my applet to run..

Update:11-30Source: network consolidation
Hi, I am having the utmost trouble getting my applet to run. First I spent a month correcting syntax and other errors generated during compile. Now I find myself spending another month getting the compiled product to run. I don't care if the screen is completely blank and my logic is all messed up, I don't mind logic debugging. My applet just will not run at all, it won't even initialize.
First when I tried to run my applet in Internet Explorer I got the following error in the statusbar:
"load: tsorgi5 can't be instantiated"
So, I researched that error message, and the solution appeared to be that I would need to use the Java Plug-In. So, I use that and now I find this message in the statusbar:
"exception: null."
That happens when the text "Loading Java Applet ..." is in the centre of the applet, and Internet Explorer acts like it is still doing something no matter how long I wait.
I tried researching this, but only found "exception: null" with other things after the text "null."
In Forte, when I choose "Execute" I get the following in the Output Window, I/O tab:
java.lang.NoSuchMethodError: main
Exception in thread "main"
I would assume it expects me to add a method "main()," but I also get that same message with a different applet (which doesn't have a method "main()") which runs perfectly fine.
I usually try to solve many of my problems myself, but with this one I have no idea where to start looking for answers. I'm relatively new to Java, been using Java for only half a year, so this particular problem is like looking for a four-leaf clover in the streets of New York City..
I'm going to be chopping my applet into pieces, having a separate class file for each major engine. (It is a role-playing game, so I'll separate battle engine from cut-scene engine from world exploration engine etc..) Hopefully I will be able to narrow down my search for what is causing me all of these problems. Then once I solve my problems I can piece everything back together.
In the meantime, I am hoping that some of you could help me out so that I may know what I am looking for.
Thank You for your time,
-Tony Slater

The Best Answer

Ah.. Forte is still a bit confusing to me, I have not and probably will not take the time to learn much about Forte, as the only real reason I use it is because unlike wordpad, I can see line numbers. =] Very helpful with my program being the size that it is.
I do not think that the simple applet idea will be of much use, because one of my earlier applet projects (a main menu for my current project) which I mentioned above as another applet without a main() method which worked perfectly fine is very simple. Although I will try it anyway, as it could help and you are most likely much more experienced than I. =]
Okay, I typed the following in the Dos Prompt:
appletviewer TestApplet.class
..It printed a blank line, paused a little bit, then brought me back to the prompt, just like running a dos program that does not give any output. I'm not sure, but I would assume it should print a line containing the text "Here?" I have not used appletviewer before, so I do not know what it is supposed to do. =P
I have already tried using System.out.println, but the problem occours even before the applet is started. I'll try enabling the Java Console first thing tomorrow morning, since a restart is required when enabling it.
Now, I would be happy to post some code, but I'm not sure it would be best to post the code when my program is 2814 lines.. although 800 lines are probably comments, and most of those comments are probably irrelevant. Also I can sometimes be a messy coder. Although I can post some general information and can probably (with a little work) post an "outline" of the code.
Since it is getting late I'll just post some portions of code which hopefully will prove important.
// Import Packages
import java.awt.Graphics;
import java.awt.Color;
import java.awt.*;
import java.applet.*;
import java.lang.System;
import java.lang.reflect.Array;
import java.lang.Math;
import java.lang.Double;
import java.math.*;
import java.util.Random;
variable/object types created and/or declared between "public class.." and "public void init()...":
arrays are filled in the init() method.
public String getIniStrValue(String iniFile, String iniGroup, String iniItem) // Used for retrieving information from the game's external file system.
another method getIniIntValue(int, String, String, String) is used for int values stored in external files.
Within public void paint(), gameplay modes are detected and dealt with accordingly. With Cut-Scenes, proper charecter images and text is displayed, all cut-scene information is stored externally. Other modes do virtually the same, display graphics and text based on internal game data or un-changing external data files.
Within public void mouseClick(), in certain modes of the game the mouse click will trigger a change no matter where the user clicked (such as cut-scenes, to advance to the next line of dialog), or different variables are set depending on where the user clicked. (What I like to call.. custom buttons) At the end of the method repaint(); is used, and the paint() method will alter the screen according to any changes that may have happened.
public void charAttack() is a method called to handle battle equations when a playable and controllable charecter is making a move. It will detect the current charecter, detect the move being made by the charecter (attack, special move, magic, etc) and will change any variables accordingly and will then use repaint(); so that the player may know what has happened. (Whether or not attack was successful, how many HP the enemy lost, etc)
public void loadBattle() is called when the charecter encounters an enemy. It will load possible enemies of the current part of the world being explored, select one, then load that enemy's "stats" from external game data files, and will then specify the new mode (Battle Menu, where the player chooses the moves to be made for the turn) by setting the int value "Mode." repaint(); is then called and it will paint the battle menu.
public boolean keyDown() is of course used to detect keyboard events. In world exploration, the charecter will be moved accordingly. In modes such as cut-scenes, a variable will be changed to advance to the next line of speech. In menus, the keyboard events are used to switch between options. repaint(); is used to update the screen accordingly.
Well, even though I very briefly summarized the code, it appears to have taken half an hour to do. I'll be getting some sleep in a few minutes, and when I wake up tomorrow morning I hope to both see and make some progress on solving this problem.
Thank You,
-Tony Slater.
  • Why can't I get an applet to run in the OC4J embedded server? Update:10-11

    i've set the class path and so on but still no dice. I keep getting the error message: load: class model.Applet1 not found. java.lang.ClassNotFoundException: model.Applet1      at sun.applet.AppletClassLoader.findClass(Unknown Source)      at

  • Using an Applet to run another application Update:10-11

    To anyone that can help. Simply, can I have an applet that runs an PC application? More detail: I am relatively new to the Java Development environment, but so far have put together a reasonable intranet web application that takes user input and writ

  • Please help - trouble getting any applet to run with Mozilla or IE? Update:10-11

    Hello, I am using Mozilla Firebird and MS IE 6 under WinXP Pro. I have installed JRE 1.4.2 and ensured that java is enabled in both browsers. But no matter what I do, no applet will run, at all. No classes are loaded, I just get an empty "resource no

  • Can a thread created in an applet still run after the browser is closed? Update:10-11

    Dear all, I was able to make an applet's thread keep running even the web page changed to other page. Is it possible to make a thread spawned by an applet keep running even if the browser is close? I am using signed applet and JRE1.3.1_02. Thank for

  • I can't get applets to run - I messed up machine Update:11-30

    This is not a programming question, just an "I want to see an applet" question. 2 months ago, I downloaded the JDK 1.3.1_02 because I was/am taking a programming class. I set the path variable to the BIN. I then had 2 runtime environments 1.3.1

  • is invoked twice when applet is loaded. Update:11-30

    When I am loading my applet in the browser, function is invoked 2 times according to JProfiler. How can we solve this problem to reduce the number of calls to one??? TIA AshishAnyone having slightest of idea about this pr

  • I can not get Java applets to run on my MAC Update:11-30

    I am running OSX 10.9.1, Safari Mountain Lion 7.0.1 and have Java 7u51 and can not figure out how to get applets to run.  I am taking classes for work and they all use applets.  Any ideas how to enable applets?  Blogs have recommended using java pref

  • Applet Not Running in IE. Need IE settings for running applet. Update:11-30

    Hi I am facing a problem with Applet while running in IE-6. The problem is very simple; Applet is not running in IE-6, not even a simple applet which displays just a Label. I am using Java Version 1.4 Settings for IE is as follows Java (Sun) CHECKED

  • Applet doesnt run in netscape Update:11-30

    I have made an applet that runs under the applet viewer. In netscape the button, labels, and textfields show, but the button doesn't produce the remainder of the run, as evidenced by no painting, like it does in the other situations. It also runs as

  • Need help getting my applet to run.. Update:11-30

    Hi, I am having the utmost trouble getting my applet to run. First I spent a month correcting syntax and other errors generated during compile. Now I find myself spending another month getting the compiled product to run. I don't care if the screen i