GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Apr-2008, 08:17
mamz mamz is offline
New Member
 
Join Date: Jan 2008
Posts: 12
mamz is on a distinguished road
Unhappy

Help with classes


hi,
I have a programme which has 3 classes. i have all 3 in different class files. how can i use the other two classes from the one which contains my main method?

thank u in advance!!
  #2  
Old 15-Apr-2008, 18:55
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Help with classes


If the classpath is properly set, then those other classes should be visible to the class with main().
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 15-Apr-2008, 19:54
mamz mamz is offline
New Member
 
Join Date: Jan 2008
Posts: 12
mamz is on a distinguished road

Re: Help with classes


but when i try to compile, the class with main it gives me an error!
  #4  
Old 15-Apr-2008, 20:22
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Help with classes


How are you compiling? [gcj, eclipse, or some other tool?]
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 16-Apr-2008, 00:52
mamz mamz is offline
New Member
 
Join Date: Jan 2008
Posts: 12
mamz is on a distinguished road

Re: Help with classes


compiling with gcj. should i import the classes to the main method? if so what is the way. the test classes for all 3 compiles fine. but i cannot put them together!
  #6  
Old 16-Apr-2008, 06:05
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Help with classes


Quote:
Originally Posted by mamz
but when i try to compile, the class with main it gives me an error!
Yes, I found that annoying with gcj, but the class that contains main needs to specified when compiled. For example, using the class I provided in your other post, the command used to compile that (with gcj) is: (using both Fedora5, and cygwin that I have)
Code:
gcj --main=Alpha Alpha.java
I had to RTFM to find that '--main' tidbit.
HTH
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #7  
Old 16-Apr-2008, 08:02
mamz mamz is offline
New Member
 
Join Date: Jan 2008
Posts: 12
mamz is on a distinguished road
Thumbs up

Re: Help with classes


thanks a lot!!!!!! it worked at last!!
  #8  
Old 18-Apr-2008, 08:04
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Help with classes


Note too, that you can also compile by simply using the javac [java compile] command:
Code:
javac Alpha.java
and this will eliminate the need for the '--main=' option with gcj.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plz anyone help to fix the linking errors: dathatreya MS Visual C++ / MFC Forum 0 03-Apr-2008 00:19
Trouble with Classes Within Classes jdbrine CPP / C++ Forum 2 29-Jun-2006 15:26
Classes initiation kdsXchris CPP / C++ Forum 3 05-Jun-2006 03:07
Re: Derived FLTK Classes cable_guy_67 FLTK Forum 0 26-Jun-2005 20:07
Assistance with classes... Bravebird CPP / C++ Forum 7 27-Apr-2005 13:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 23:47.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.