Could not find Main Class while executing JAR

G

Grzesiek

When i double -click my jar file in dist folder everything is ok, but
when i copy it to another folder and then i double click it again i
get message box:
"Could not find the main class. Program will exit"


Here is my manifest file:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.6.0_01-b06 (Sun Microsystems Inc.)
Main-Class: myPackage.MyClass
Class-Path: lib/log4j-1.2.14.jar
X-COMMENT: Main-Class will be added automatically by build

The problem started when i added lib/log4j-1.2.14.jar to Class-Path.
What can i do?

Thanx
 
L

Lars Enderin

Grzesiek skrev:
When i double -click my jar file in dist folder everything is ok, but
when i copy it to another folder and then i double click it again i
get message box:
"Could not find the main class. Program will exit"


Here is my manifest file:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.6.0_01-b06 (Sun Microsystems Inc.)
Main-Class: myPackage.MyClass
Class-Path: lib/log4j-1.2.14.jar
X-COMMENT: Main-Class will be added automatically by build

The problem started when i added lib/log4j-1.2.14.jar to Class-Path.
What can i do?

You have to include the full path of the jar file to Class-Path, if you
refer to it outside the dist folder.
 
G

Grzesiek

Grzesiek skrev:









You have to include the full path of the jar file to Class-Path, if you
refer to it outside the dist folder.- Ukryj cytowany tekst -

- Poka cytowany tekst -

Txanx Lars the problem was that lib/log4j-1.2.14.jar was not found
 
L

Lew

Lars said:
Lew skrev:
Ok, but relative to what? He copied the program to a place outside the
dist folder, but did not copy the dist/lib/log4j* jar file to the same
place, apparently.

What is the "dist" folder?

The provided link explains it all, if you follow it.
Note : The Class-Path header points to classes or JAR files on the local network

In other words, relative to the directory in which the application JAR is
installed.

From the same link:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top