mainclass

how to run a class from java jar file on Hadoop?

拟墨画扇 提交于 2020-01-15 10:06:45
问题 I have a jar file exported from Eclipse (Runnable JAR>>Copy required libraries into a sub folder). In java if you set the main class in the manifest.xml you can run: java -jar MyTest.jar arguments if you want to run another main class in the jar file or if you didn't set a main class in the manifest.xml you can run: java -cp MyTest.jar MyOtherMainClass arguments In Hadoop if main class is set in manifest.xml you can run: hadoop jar MyTest.jar arguments If you type: hadoop jar MyTest.jar

Why it could not find the main class?

穿精又带淫゛_ 提交于 2020-01-01 09:04:43
问题 I have a very simple code: package mygame; public class RunGame { public static void main(String[] args) { System.out.println(args[0]); } } I can compile that code but I cannot run it. When I type "java RunGame" in the command line I get: Exception in thread "main" java.lang.NoClassDefFoundError: RunGame (wrong name: mygame/RunGame). .... Could not find the main class: RunGame. Program will exit. 回答1: java mygame.RunGame is the java executable syntax. i.e, java classname.qualified.with.full

Problem running a Jar file

浪尽此生 提交于 2019-12-20 03:13:33
问题 I've compiled a java project into a Jar file, and am having issues running it. When I run: java -jar myJar.jar I get the following error Could not find the main class: myClass The class file is not in the root directory of the jar so I've tried changing the path of the main class to match the path to the class file and I get the same issue. Should I be flattening the file structure? if so how do I do this. I'm using Ant to build the Jar file if thats of any use. UPDATE Here is the contents of

Maven adding mainClass in pom.xml with the right folder path

☆樱花仙子☆ 提交于 2019-11-30 07:19:31
问题 I want to get a working jar file with my maven project. The build part is: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.14</version> <dependencies> <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> <version>6.4.1</version> </dependency> </dependencies> <configuration> <consoleOutput>true</consoleOutput> <configLocation>${basedir}/src/test/resources/checkstyle_swt1.xml<

Maven adding mainClass in pom.xml with the right folder path

我的未来我决定 提交于 2019-11-29 02:52:51
I want to get a working jar file with my maven project. The build part is: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.14</version> <dependencies> <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> <version>6.4.1</version> </dependency> </dependencies> <configuration> <consoleOutput>true</consoleOutput> <configLocation>${basedir}/src/test/resources/checkstyle_swt1.xml</configLocation> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId>

“Could not find the main class” when double-clicking .jar file

半城伤御伤魂 提交于 2019-11-27 11:48:28
First: I realize that this issue should be quite simple and lots of people seem to have experienced it. However, it appears my issue may be slightly different from existing posts. I'm using NetBeans to compile a Java application. When it's done building, the output goes into the dist\ folder correctly. The jar file is present there. If I go to the command line, navigate to that folder, and call the following: java -jar Prosperity.jar everything works fine. Obviously the name of the application is Prosperity. The following command also works fine: javaw -jar Prosperity.jar However, double

“Could not find the main class” when double-clicking .jar file

a 夏天 提交于 2019-11-26 15:46:36
问题 First: I realize that this issue should be quite simple and lots of people seem to have experienced it. However, it appears my issue may be slightly different from existing posts. I'm using NetBeans to compile a Java application. When it's done building, the output goes into the dist\ folder correctly. The jar file is present there. If I go to the command line, navigate to that folder, and call the following: java -jar Prosperity.jar everything works fine. Obviously the name of the