Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2009, 08:31 PM
Member
 
Join Date: Jul 2009
Posts: 10
Rep Power: 0
nishant.4545 is on a distinguished road
Default could not find main class, the program wil exit-- error in jar file
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 created a jar file of this program using following commands in 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?
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-03-2009, 09:41 PM
angryboy's Avatar
Senior Member
 
Join Date: Jan 2009
Location: Javaland
Posts: 742
Rep Power: 2
angryboy is on a distinguished road
Default
double posted:
jar file problem
__________________
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Could not find the main class: error... bobleny New To Java 21 03-02-2010 11:53 AM
Could not find the main class, program will exit. aryubi New To Java 39 02-19-2010 11:02 AM
Could not find the main class. Program will exit. Carrier New To Java 1 04-22-2009 03:27 AM
"Could not find the main class: comparisonDemo.class. Program will exit." ziisrick New To Java 4 02-10-2009 01:32 PM
Error: Could Not Find Main Class. Program Will Exit silvia New To Java 1 07-19-2007 05:58 PM


All times are GMT +2. The time now is 10:49 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org