I wrote a simple program to run on a remote server, but there was a banal and stupid problem. I launch from the console:

username:my_parser user$ java errorParser.jar Error: Could not find or load main class errorParser.jar 

The Main class has a main method. I collected from IDEA, in the screenshot I parametrized the build through artifacts, then Build> Build Artifacts

enter image description here

Tell me what could be the problem? (mac os)

Closed due to the fact that it was off topic by aleksandr barakin , lexxl , user207618, kmv , rdorn Aug 17 '16 at 22:07 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - aleksandr barakin, lexxl, community spirit, kmv, rdorn
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • and you definitely have a public static void main(String[] argv) method public static void main(String[] argv) exactly 1 class. - pavel
  • @pavel that's right - in the Main class there is only one public static void main (String [] args) method in one instance - abbath0767
  • java -jar errorParser.jar tried? - Roman
  • one
    Unzip this jar and display the contents of MANIFEST.MF and the folder / file structure inside the jar. - Roman
  • one
    I do not know what I did wrong, got rid of the problem simply by configuring pom.xml and collecting it through the console maven - abbath0767

1 answer 1

I did not understand what I did wrong in setting up the assembly of artifacts in the development environment. But instead I decided to use the standard script — configure pom.xml and build via the console. Sam pom.xml :

 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework</groupId> <artifactId>sms</artifactId> <packaging>jar</packaging> <version>0.1</version> <dependencies> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.2</version> </dependency> </dependencies> <properties> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.source>1.7</maven.compiler.source> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>Main</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <sourse>1.7</sourse> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <outputDirectory>${project.basedir}</outputDirectory> </configuration> </plugin> </plugins> </build> </project>