• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiles but does not run! HELP!!!  RSS feed

 
Naf Rash
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a main class and two other classes. when certain buttons are pressed methods from the other classes are invoked. However, when I run the program I don't think that the methods from the other classes are actually invoked. I have created objects of these other 2 classes in the main class and the program as a whole compiles- but when I run it, only things that have been declared in the main class run. At the point when methods from the other classes should be invoked, the program simply terminates. Do you have any suggestions why this is? Plaese help- I need all the help I can get!
 
john smith
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your source code (or a snippet thereof if it's too long) - it's a little hard to understand what you are trying to do from your description.
 
Naf Rash
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could put down some code for this but there is so much of it! It will be quite to understand it especially if you don't know what the program is trying to do. I'll try to be more detailed here in explaining what i am doing. I have 3 classes, say A, B and C.
Class A is basically a user interface and when the name of a database is specified a connection is made to it! After a connection has been established another dialog box appears asking the user to select a radio button. When a radio button is pressed some calculations need to take place and this is basically where the relevant method from class B is invoked. However, this is not happening - at this point the whole program just terminates. I should mention that in class B a method has been defined to get the value of some variables in class A.
Once the method has completed in class B a method of class C is then invoked, which at the moment just prints some lines for the user (on the screen).
At present an object of classes B and C is created in class A, and all message passing ie, the variable values that need to be passed when a method from another class is invoked is done through class A. like I said the program compiles but does not run as it should.
I could post the code but then you would have to create a database and initialise it with a password and also set and ODBC path for it too. Please do try to help because I have been stuck on this for a couple of days now and don't know how to get round it.
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you get any errors, or does it just terminate without any errors?
is there anything on the command line to let you know what is happening?
have you got a system.exit(0); method when you call the certain method from class B which you say terminates?
Have you got objects of the other classes in the main method so that you can invoke other methods.

Davy
[ March 09, 2004: Message edited by: Davy Kelly ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!