Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   how to determine if jar or class file is executable (http://www.velocityreviews.com/forums/t125682-how-to-determine-if-jar-or-class-file-is-executable.html)

kaith 08-15-2003 09:45 PM

how to determine if jar or class file is executable
 
How can I determine if a particular class file/jar file is directly
executable, meaning it has a main etc.

Roedy Green 08-15-2003 11:21 PM

Re: how to determine if jar or class file is executable
 
On 15 Aug 2003 14:45:16 -0700, jobs239@hotmail.com (kaith) wrote or
quoted :

>How can I determine if a particular class file/jar file is directly
>executable, meaning it has a main etc.


You can read and parse the manifest. It is just a text file entry. I
don't know of a more direct way. It still won't necessarily execute.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Sandip Chitale 08-16-2003 07:46 AM

Re: how to determine if jar or class file is executable
 
Roedy Green <roedy@mindprod.com> wrote in message news:<qmqqjvgkqe445l91jpsblufb8nqap6gruk@4ax.com>. ..
> On 15 Aug 2003 14:45:16 -0700, jobs239@hotmail.com (kaith) wrote or
> quoted :
>
> >How can I determine if a particular class file/jar file is directly
> >executable, meaning it has a main etc.

>
> You can read and parse the manifest. It is just a text file entry. I
> don't know of a more direct way. It still won't necessarily execute.


To read the manifest use

http://java.sun.com/j2se/1.4.2/docs/...l#getManifest()

For the class you could use reflection to see is a method

public static void main(String[] args)

is present.


All times are GMT. The time now is 10:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57