0

I'm trying to run a jar file from command line on Windows using:

java -cp .;C:\java\empacotadoJars\Empac.jar;C:\java\empacotadoJars\ClienteEmpacotado.jar ClienteEmpacotado

It raises the exception:

Could not find or load main class ClienteEmpacotado

The classes are:

public class Empacotado{
    public static void escrever(){
      System.out.println("Chamndo metodo de classe Empacotado!");
    }
}

public class ClienteEmpacotado{
   public static void main(String args[]){
      Empacotado.escrever(); 
   }

}

Empacotado.class is inside Empac.jar and ClienteEmpacotado.class is inside ClienteEmpacotado.jar. I first zipped each one and then renamed to jar extension. Inside ClienteEmpacotado.jar I created META-INF folder with MANIFEST.MF file, which contains:

Manifest-Version: 1.0
Main-Class: ClienteEmpacotado

What might be wrong?

4

1 回答 1

0

问题是我使用 Winrar 制作 zip 文件(然后我重命名为 jar 扩展名)。使用“jar cvf Package.jar Arq.class”来解决 jars。

于 2013-11-10T01:18:10.160 回答