473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

exception in initializer error?

59
I created a japplet in java and put it on website. there are no errors in eclipse and it works fine.

on web it say "Error - click for details". when i click on it, it says 'ExceptionInInitializerError' but no details.

does the error has to do with the code below?

Expand|Select|Wrap|Line Numbers
  1. public void run()
  2.     {
  3.         while(!player_class.isDEAD())                         
  4.               {
  5.             ....    
  6.             repaint();
  7.             try
  8.             {
  9.                 Thread.sleep(10);
  10.             }
  11.             catch(InterruptedException e)
  12.             {
  13.                 e.printStackTrace();
  14.             }    
  15.         }/*** end of while loop ***/
  16.     }/*** end of run method ***/
  17.  
Apr 30 '13 #1
5 3423
Nepomuk
3,112 Expert 2GB
According to the java api docs, this Error is thrown when there's a problem in a static initializer. So, while the above code may CALL something static, there's no way for us to know without more context.

I would suggest checking everything static for errors. Everything else depends on code you haven't posted.
Apr 30 '13 #2
game2d
59
by static do you mean static variable or method?

bc i have some static variables:

private static final long serialVersionUID = 1L; //in main
public static final int WINDOW_WIDTH = 900; //in main
public static final int WINDOW_HEIGHT = 400; //in main
public static final int DELAY = 15; //in main
Apr 30 '13 #3
Nepomuk
3,112 Expert 2GB
Those look ok, at least out of context. I am however a little confused by the comment
Expand|Select|Wrap|Line Numbers
  1. //in main
after every line. Are they in a main method? If so, that main method won't be called when running the code as an applet (unless you call it manually). So everything in that method needed for the applet to run would have to be moved elsewhere (e.g. into the run method).

Also, please use [code] tags for posting code.
Apr 30 '13 #4
game2d
59
no not main method. i ment main class. i have thoese 4 static variables are in top of main class. and i am using these static variables in different classes by
Expand|Select|Wrap|Line Numbers
  1. Main.WINDOW_WIDTH
  2.  
do you think this is the problem?
Apr 30 '13 #5
Nepomuk
3,112 Expert 2GB
Hm, it shouldn't be... Is there anything else that's static? And when you click on click for details (you know, where you got the ExceptionInInitializerError), is there anything clickable there? There should be a stacktrace or something. Alternatively, the server you're running should have a log file in which you can check the details. Somewhere there it should tell you what line of code caused this error.
May 2 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: J. Muenchbourg | last post by:
I'm getting an Exception occured error on line 4 (For i =1...) <% Function ProperCase(strIn) strOut = "" boolUp = True For i = 1 To Len(strIn) c = Mid(strIn, i, 1) if c = " " or c = "'" or c...
1
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are...
6
by: Paul Steele | last post by:
I often use the following code to check if a program is already running: if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1) ... This works find on all of my...
5
by: Peter Steele | last post by:
We have an application that when it runs in the IDE in debug mode an unhandled exception is occurring in a system header file associated with STL stirngs. The actual statement that crashes is ...
0
by: Rod | last post by:
I've got Crystal Reports XI Release 2, for development with Visual Studio ..NET 2005. I've taken a VS .NET 2003 WinForms application that I wrote in C#, and upgraded it to VS .NET 2005. It has...
0
by: sobhan | last post by:
Hi, Yhis is sobhan, i haveused Microsoft Access in my Application.it works fine but sometimes an error occurs oledb exception :Unspecified Error .what is the solution. plz help
1
by: John Dann | last post by:
Running VB2005 on Windows XP SP2: I've started to get type initializer errors on Form1 whenever I try to run a project within the IDE - this never used to happen. I can open the project within...
16
by: john6630 | last post by:
Coming from the .Net world, I am used to the try...catch...finally approach to error handling. And PHP 5 now supports this approach. But I am not clear what happens to unhandled errors/exceptioins?...
1
by: Arjita31 | last post by:
I am getting the following error: "The type initializer for '...' threw an exception." What could be the solution? I have tried many things but in vain. My app is working in the development...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.