java - packaged to jar, running in cmd, but cannot find main class -


I am trying to run my Java class with dependency in the command line and I am using IntelIjie Idea 13 So that the artifacts can be prepared from my project. I have a main square "Main Java" and after creation I have a jar file like mytest.jar. The full name of Maine Java is like "test.main"

But when I'm trying to run it using "java mytest.jar", then he complained that the main square mytest.jar can not be found.

I checked the files in the jar and it seems that I get all the dependencies, and the main square in the manifest. MF also looks fine And actually if I open the jar in the "Mitest" folder, and I try to run "Java Test Maine" then I do a good job.

My Jar file is like this:

MATTEST

- Exam

---- Main Class

- Meta-INF

---- MANIFEST.NF

- org ... // Dependency

My MANIFEST.MF is like this:

MANIFEST - Version: 1.0

Main-Class: test.Main

What is the advice?

UPDATE: Man-Class MANIFEST.MF test. Main, I'm using a simple example in this question and forgot to change the content, sorry.

In your manifest, type the main-class attribute to test. Main . I have not used the idea yet, but for example in eclipse, you can specify that the running configuration will be generated from the executable jar file.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -