 |
 |
Java: How to set main-class in PB
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2001
Status:
Offline
|
|
I guess that I'm asking a pretty dumb question, but how do I explicitely set the main-class in Java-project in PB? PB seems to assume that it always is a class which name is equal to the projectname in the beginning.
Someone please help!
Dunk
|
|
Bland alla möbler i ett hus
förtjänar Sängen mest att prisas!
Här sover drinkarn bort sitt rus,
här älskarns heta plågor lisas.
E.J. Stagnelius
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
What do you mean by "main-class" 
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Oct 2000
Location: Washington, DC
Status:
Offline
|
|
That question was asked on the java-dev listserv @ apple, and someone explained how. I'm currently working on a Java on Macs resource website, and I'll make sure this question gets included in the FAQ.
For now, you might want to search the java-dev listserv archive at apple.
-tim
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Oct 2000
Location: Pasadena, CA, USA
Status:
Offline
|
|
What do you mean by "main-class"
Typically, in a Java application, this would be the class with main() method - the entry point for the application. Sun's convention to actually name the class "Main", so you'd start your application:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> java package.Main </font>[/code]
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
I never use Java personally, but have you tried your target settings?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2001
Location: Fluidic Space
Status:
Offline
|
|
I'm not sure about this but it might work. Remove the "public static void main(String[] args)" method from the class that PB creates when you name the project. Add a new file to the project and name it Main.java. Put the main method in class Main. I think you can delete the class PB made if you want to.
BTW, What is the purpose of having a class named Main?
[ 01-15-2002: Message edited by: Species 8472 ]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by Species 8472:
<STRONG>BTW, What is the purpose of having a class named Main?
</STRONG>
It is purely a naming convention. The same reason why people write main(char * argv, int argc) in main.c. They do it so that when you examine a package with 20+ classes you can instantly locate the class with the starting point (unless there are several, which is certainly possible).
Sun seems to be fairly consistent about using Main in it's JDK tools - but in practice it seems not to be the case most of the time. You tend to see things like:
mocha.Decompiler
domain.Domain
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2001
Status:
Offline
|
|
Hi again!
Thx for the suggestions, but they didn't really help, and I couldn't find the answers on java-dev. I'll just explain the problem once more:
I make a new project with PB. I name it "Honk". I get a class "Honk", which includes the main()-method. Then, I rearrange the package-structure, so that class Honk is no longer just "Honk", but "abc.Honk". On running the project, I get the err-msg "class Honk not found". So, how do I tell PB not to look for "Honk", but for "abc.Honk"? I looked through all the menues, but didn't find the answer.
Greetings,
Dunk 
|
|
Bland alla möbler i ett hus
förtjänar Sängen mest att prisas!
Här sover drinkarn bort sitt rus,
här älskarns heta plågor lisas.
E.J. Stagnelius
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by dunken6969:
<STRONG>Hi again!
Thx for the suggestions, but they didn't really help, and I couldn't find the answers on java-dev. I'll just explain the problem once more:
Dunk  </STRONG>
I guess I have to make your day. Here are the steps starting with where you left off:
1 - Click the vertical tab along the middle labelled "Targets"
2 - Click the target displayed in the upper left panel
3 - Click on the tab on the right called "Executables"
4 - Click on the tab under that called "Arguments" (or "Argum..." - it's the first tab.)
5 - What it shows there is astonishingly like the command line for java - which it is. It should show -classpath "Honk.jar" Honk - Just replace that with -classpath "Honk.jar" abc.Honk and you're there.
How easy was that? 
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2001
Status:
Offline
|
|
Originally posted by absmiths:
How easy was that?  [/QB]
Uh. I feel dumb... Thx! 
|
|
Bland alla möbler i ett hus
förtjänar Sängen mest att prisas!
Här sover drinkarn bort sitt rus,
här älskarns heta plågor lisas.
E.J. Stagnelius
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|