d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Eclipse Question
Add Reply New Topic New Poll
Member
Posts: 2,118
Joined: Dec 18 2011
Gold: 295.61
Aug 10 2013 02:15am
hey guys, im getting used to eclipse and i decided to make a method that uses multiple classes. i ran the program and it asked which classes i would like to run, and allowed me to check
the boxes for both of them, however i didnt realize i forgot a semi colon(lol). after i fixed it, i tried to run it again but it only tries to run the class im currently in, instead of giving me the same option as before,
thus giving me an error. how do i fix this?
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Aug 10 2013 02:21am
post your code
Member
Posts: 2,118
Joined: Dec 18 2011
Gold: 295.61
Aug 10 2013 02:24am
class 1

public class jdn{
public static void main(String args[]){

apples applesObject = new apples();
applesObject.simpleMessage();


}
}

class 2


public class apples {
public void simpleMessage{

System.out.println("this is another class");
}

}
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Aug 10 2013 02:29am
Sounds like its going to have more to do with eclipse than your code now that I think about it. Have you tried restarting eclipse?

Also, what error are you getting?

This post was edited by SelfTaught on Aug 10 2013 02:30am
Member
Posts: 2,118
Joined: Dec 18 2011
Gold: 295.61
Aug 10 2013 02:31am
i have and i still get this when i run the class jdn:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method simpleMessage() is undefined for the type apples

at jdn.main(jdn.java:7)

This post was edited by Engrish on Aug 10 2013 02:32am
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Aug 10 2013 02:37am
Quote (Engrish @ Aug 10 2013 12:31am)
i have and i still get this when i run the class jdn:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method simpleMessage() is undefined for the type apples

at jdn.main(jdn.java:7)



Try adding () to the simpleMessage function in the apple class

So it would be

Code
public void simpleMessage(){

System.out.println("this is another class");
}


This post was edited by SelfTaught on Aug 10 2013 02:38am
Member
Posts: 2,118
Joined: Dec 18 2011
Gold: 295.61
Aug 10 2013 02:41am
Quote (SelfTaught @ Aug 10 2013 03:37am)
Try adding () to the simpleMessage function in the apple class

So it would be

Code
public void simpleMessage(){

System.out.println("this is another class");
}


that did it, thanks man

cant believe i missed that lol
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Aug 10 2013 02:42am
Quote (Engrish @ Aug 10 2013 12:41am)
that did it, thanks man

cant believe i missed that lol


Np

Lol, no worries. It happens to all of us.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll