This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Displaying name of class that contains main Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Displaying name of class that contains main" Watch "Displaying name of class that contains main" New topic
Author

Displaying name of class that contains main

Pete Hitchman
Greenhorn

Joined: Oct 29, 2002
Posts: 4
Hi,
I am writing a java application and I am checking the number of arguments passed on the
command line and if this fails printing out a
usage message. I would like the usage message
to include the name of the class that contains
the main method. How do I access this information?


Regards<br /> <br />Pete
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Try this

Rene


Regards, Rene Larsen
Dropbox Invite
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
If you are WRITING the app . . .

(I must be missing something here . . . )


"JavaRanch, where the deer and the Certified play" - David O'Meara
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

or if you want to get the Class name from a method other then a static one:

Rene
Pete Hitchman
Greenhorn

Joined: Oct 29, 2002
Posts: 4
Thanks people.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying name of class that contains main
 
Similar Threads
Finding the caller of a class
help with MemoryPoolMXBeans
why is this happening REALLY URGENT
Error in Eclipse and Netbeans
Java 5.0 static import same members collision from different classes