Results 1 to 2 of 2
Thread: jar file problem
- 07-03-2009, 07:23 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 10
- Rep Power
- 0
jar file problem
hello everyone,
the source code for my program is
import java.util.*;
class Sort
{
public static void main(String q[])
{
long start=System.currentTimeMillis();
int a[]=new int[100000];
Random r=new Random();
for(int i=0;i<a.length;i++)
a[i]=r.nextInt();
for(int i=0; i<a.length-1;i++)
{
for(int j=i+1;j<=a.length-1;j++)
{
if(a[i]>a[j])
{
int t=a[j];
a[j]=a[i];
a[i]=t;}
}}
long end=System.currentTimeMillis();
System.out.println("time:"+(end-start));
}}
then i have a created jar file of this program using following commands int the command prompt:
echo Main-Class: Sort >manifest.txt
jar cvfm Sort.jar manifest.txt Sort.class
This creates the jar file. But when I try to run it by double clicking i get the error 'could not find main class. the program will exit'
Also when i try to run it in command prompt I get an exception that it could not find the main class.
What should I do?
- 07-03-2009, 08:36 PM #2
the manifest file need a newline after it. Otherwise jar will strip off that line.
also try this:
Java Code:jar -efc Sort Sort.jar *.class // jar -efc {Main-Class} {Jar-Name} {.class-files}Last edited by angryboy; 07-03-2009 at 10:00 PM.
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
Similar Threads
-
Problem while writing xml file
By Rajesh Sahu in forum Java ServletReplies: 0Last Post: 12-23-2008, 04:53 PM -
problem with jar file
By biba84 in forum Advanced JavaReplies: 7Last Post: 11-09-2008, 06:46 PM -
problem - using a jar file
By jon80 in forum New To JavaReplies: 6Last Post: 07-07-2008, 07:49 AM -
[SOLVED] file i/o problem
By aytidaalkuhs in forum New To JavaReplies: 3Last Post: 04-06-2008, 06:42 PM -
problem with jar file pls help
By jinu5 in forum New To JavaReplies: 0Last Post: 08-15-2007, 10:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks