Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to determine if jar or class file is executable

Reply
Thread Tools

how to determine if jar or class file is executable

 
 
kaith
Guest
Posts: n/a
 
      08-15-2003
How can I determine if a particular class file/jar file is directly
executable, meaning it has a main etc.
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      08-15-2003
On 15 Aug 2003 14:45:16 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (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.
 
Reply With Quote
 
 
 
 
Sandip Chitale
Guest
Posts: n/a
 
      08-16-2003
Roedy Green <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 15 Aug 2003 14:45:16 -0700, (E-Mail Removed) (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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running an Executable Before Executable JAR Jason Cavett Java 8 05-16-2007 07:14 PM
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
instanciate a class in a jar file with class.forname, while my main class is in another jar cyril Java 2 08-25-2004 06:55 AM



Advertisments