about "Could not found mainclass.Program will exit!"...

about "Could not found mainclass.Program will exit!"...

My package is "cn.com.ch2000.yangsl"

The main class is BJInfo.class

My MANIFEST.MF setting as follows:

Manifest-Version: 1.0

Created-By: 1.4.0_01 (Sun Microsystems Inc.)

Main-Class: cn.com.ch2000.yangsl.BJInfo

I exec jar.exe as follows:

jar cvfm BJInfo.jar C:\j2sdk1.4.0_01\bin\MANIFEST.MF D:\cn\com\ch2000\yangsl

finally,I exec"javaw BJInfo.jar"

The system pop message "Could not found mainclass.Program will exit!"

why?

My E-mail is yangsl@ch2000.com.cn

Thank u for your restore...

[629 byte] By [yangshaoliang] at [2007-9-27 19:39:03]
# 1

A couple questions that need to be answered before we can get to the real problem.

1. Does it run fine before being put into a jar file? (I'll assume yes, since you would probably not be asking the question.)

2. What directory are you jarring the files from? You should be jarring the files from the directory that contains the TOP level of your packages, and including the TOP level directory, and it will recurse over the lower level directories and include them. This will produce a jar file with the proper directory structure, like :

cn/com/ch2000/yangsi/<someclass>.class

cn/com/ch2000/yangsi/<someotherclass>.class

Note that your jar must contain all the upper level directories like this. To check that your jar has this kind of file structure, type

jar tv BJInfo.jar

3. Do you have a class called mainclass.Program, or is this just an error produced by java? If not, where is you main class in the jar? Is it at the correct directory.

In looking at this i think the command you want is:

jar cvfm BJInfo.jar <path-to>MANIFEST.MF D:\cn

Hope that helps...

jbonik at 2007-7-6 22:51:24 > top of Java-index,Developer Tools,Java Compiler...