This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trying to call a object from a different class.

 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


comes up and says package installfin does not exist???
 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
questions my package and main class are both called setup would this be a problem?
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to call a method from nowhere. must be inside a method body.
 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still not able to get this to work.
This is the code that I have inside of extractjboss class


this is the code I have in setup class



This is the error I get when I build:

extractjboss.java:275: cannot find symbol
symbol : method finish(java.lang.String)
location: class setup.extractjboss.setup
installfin.finish(curDir);
1 error
BUILD FAILED (total time: 0 seconds)

Eduardo Bueno wrote:You're trying to call a method from nowhere. must be inside a method body.
 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
extractjboss.java:275: cannot find symbol
symbol : method finish(java.lang.String)
location: class setup.extractjboss.setup
installfin.finish(curDir);
1 error
BUILD FAILED (total time: 0 seconds)


You have to show us more code... from the error message, it looks like you are playing with inner classes, or something like that....

Henry
 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is all my code from jbossextract class



and this is the top part of my code for class setup

 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You do know that you have two setup classes right? One in the setup package. The other the inner class of the extractjboss class.

So, when the inner class instantiates an setup object, it instantiates one of the inner class type. This inner setup class doesn't have a finish() method. The other setup class does.

Henry
 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
You do know that you have two setup classes right? One in the setup package. The other the inner class of the extractjboss class.

So, when the inner class instantiates an setup object, it instantiates one of the inner class type. This inner setup class doesn't have a finish() method. The other setup class does.

Henry


No I didn't but now I do... I still cant get this to work.

takes this for example

public class extractjboss implements Runnable {

I can change this to public class extractjboss extends install implements Runnable {

install is another class I have in the same package and it works fine... no errors.

but if I change it to public class extractjboss extends setup implements Runnable {

I get error can not find symbol constructor setup

The only difference I can find is that setup has all the code for my GUI.

I'm very new to java & I'm trying to learn...
 
Joey Brown
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason this code in the class I'm trying to call is giving me the error.


If I change it to this


The error "cannot find symbol
symbol : constructor Setupnew12()
location: class setup.Setupnew12
Setupnew12 newset = new Setupnew12();"

goes away but I get a different error
call to super must be first statement in constructor
super(parent, modal);
cannot find symbol
symbol : constructor Setupnew12(javax.swing.JFrame,boolean)
location: class setup.Setupnew12
new Setupnew12(new javax.swing.JFrame(), true).setVisible(true);

I love java!!!
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not allowed a return type from a constructor. If you try to put a return type on a constructor, the compiler will convert it to a method which happens to look like a constructor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic