umaiyer
asked on
To Excecute an application from jar file
I have a jar file (xyz.jar) with
a1.class
a2.class
a3.class
a4.class
in which a1.class is a main class having
public static void main(String[] args)
in my manifest file i have included
Main-Class: a1.class
Now the problem is how to execute this application from the jar file directly.
This jar file is in c:\abc directory
a1.class
a2.class
a3.class
a4.class
in which a1.class is a main class having
public static void main(String[] args)
in my manifest file i have included
Main-Class: a1.class
Now the problem is how to execute this application from the jar file directly.
This jar file is in c:\abc directory
ASKER
i tried with the same command
I am getting this error:
Exception in thread "main" java.util.zip.ZipException : The system cannot find the file specified
at java.util.zip.ZipFile.open (Native Method)
at java.util.zip.ZipFile.<ini t>(ZipFile .java:112)
at java.util.jar.JarFile.<ini t>(JarFile .java:117)
at java.util.jar.JarFile.<ini t>(JarFile .java:55)
Can u just let me know what's the problem
Thanks in advance.
I am getting this error:
Exception in thread "main" java.util.zip.ZipException
at java.util.zip.ZipFile.open
at java.util.zip.ZipFile.<ini
at java.util.jar.JarFile.<ini
at java.util.jar.JarFile.<ini
Can u just let me know what's the problem
Thanks in advance.
aha - the main class should be specified as a class name - not as a file name, that contain this class:
Main-Class: a1
Main-Class: a1
ASKER
if this jar file(jarname.jar) is dependend on another jar file (comm.jar),do i have to include that jar file name in the manifest file of jarname.jar. if so how can i do this
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i have included all the jar files that are required by the application which is in jarname.jar
in the Class-Path: x1.jar x2.jar etc.......
this application also uses one xml file which is outside the jar file.This application loads the contents of the xml file.
do i have to include this xml file in the manifest file. if so how to include this resource.
the problem i am facing is.......
i have jar file & xml file in
c:\abc directory
if i go to c:\abc>java -jar jarname.jar
my application displays the contents xml file
if i give the command in this fashion
c:\>java -jar "c:\abc\jarname.jar"
my application does not displays the details of xml file
how to come across this problem. is there a way to come out of this
Thanks in advance
in the Class-Path: x1.jar x2.jar etc.......
this application also uses one xml file which is outside the jar file.This application loads the contents of the xml file.
do i have to include this xml file in the manifest file. if so how to include this resource.
the problem i am facing is.......
i have jar file & xml file in
c:\abc directory
if i go to c:\abc>java -jar jarname.jar
my application displays the contents xml file
if i give the command in this fashion
c:\>java -jar "c:\abc\jarname.jar"
my application does not displays the details of xml file
how to come across this problem. is there a way to come out of this
Thanks in advance
java -jar c:\abc\JarName.jar