aspose file tools*
The moose likes Beginning Java and the fly likes Running a class from command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Running a class from command line" Watch "Running a class from command line" New topic
Author

Running a class from command line

Neelima Mohan
Greenhorn

Joined: May 23, 2010
Posts: 27
Hi,

Is there a way to run a java class (which doesnt have a main method) and access its object, methods etc from the command line?

Thanks,
Neelima
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Yes, but you'll have to create a class that has a main method, and then in the main method create an object of the class of interest. When I do this, I often have the word "Test" in my small main method containing class. So if my original class is called Fubar, the testing class will be FubarTest or some such.

Much luck!
Neelima Mohan
Greenhorn

Joined: May 23, 2010
Posts: 27
Thanks :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running a class from command line