Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
111 views

How to fix error and what causes: Error: Main method is not static in class

I am getting this error: Error: Main method is not static in class oracle.Execution$, please define the main method as: public static void main(String[] args) When I run the command: java -jar ...
Shelen's user avatar
  • 169
0 votes
0 answers
21 views

i try to run jar file of game but it is not running showin jni erro has occured

enter image description here i created jar file of snake game. in eclipse snake game is running properly but after creating jar file it s not running as expected i am expecting it should run after ...
Sushant Dake's user avatar
0 votes
1 answer
311 views

How do I specify the entry point location in a Manifest-file to run a jar-file?

I am trying to run a program I've downloaded ( https://github.com/ottiram/MMAX2 ) which comes as a jar-file on Ubuntu 22.04. When I do, it returns: "no main manifest attribute, in MMAX2.jar"....
jak326i205's user avatar
0 votes
2 answers
4k views

Can't run .jar file created with IntelliJ / Gradle. "no main manifest attribute, in app.jar"

I've followed the advice of other solutions. Like this one. And this one. I've also tried the solution belonging to this $ java -cp app.jar main.Main I get an error that would not normally occur when ...
Sage Belknap's user avatar
0 votes
2 answers
482 views

Java Jar file main class run when runs from command line, but not from Windows batch file

I'm re-using a standalone Swing-based Java class which backs up and restores mysql databases. I've tested running it from a Windows batch file (.bat) on my dev system, and it works there. But, if I ...
Jack BeNimble's user avatar
0 votes
1 answer
1k views

Null Pointer Exception using Spring Boot service as a dependency in a batch job

I'm re-using an old, standalone AWT-based Java class which backs up and restores mysql databases. One thing it needs to do is decrypt a password that it reads from a properties file. The logic for ...
Jack BeNimble's user avatar
5 votes
1 answer
2k views

Cannot run JAR file due to cannot load main class error

I built my project and generated a JAR file using Gradle build framework. However, the output jar file fails to load the main methods from the main class (miner.Tracker) in this case. As I mentioned, ...
kjee's user avatar
  • 419
2 votes
2 answers
9k views

Java JAR: Could not find or load main class

I know this question has been asked a lot, but I have tried a few suggestions and am still getting this error. I am running the jar as follows: java -jar MyJar-1.0.jar com.me.ldap.ActiveMain, where my ...
formicaman's user avatar
  • 1,357
1 vote
0 answers
557 views

Fails to run a Jar file on macOS using Zulu JRE (8.271)

java -jar jarfile works perfectly on Windows/Ubuntu, yet on macOS, I keep getting "Could not find or load main class." Not only that, when I run the jar using Oracle's JRE - it works (the ...
Avi Edri's user avatar
0 votes
1 answer
193 views

GMavenPlus: Groovy to JAR - Failed to find or load main class. Main class is present, manifest file appears valid

I've done a successfull mvn clean install on the project I built and the structure appears correct, all classes included and manifest is under META-INF including class-paths and main-class. Not sure ...
Luponius's user avatar
2 votes
2 answers
446 views

cmake jar package cannot execute: no main manifest attribute

I've got a very simple cmake-java project from the internet as below: cat HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, ...
Hind Forsum's user avatar
  • 10.5k
2 votes
2 answers
736 views

Bazel build java demo: build ok but fail to run

I'm new to bazel and have this demo project: (1)mkdir demo-project (2)cd demo-project (3)mkdir -p src/main/java/com/demo (4)vi src/main/java/com/demo/DemoRunner.java package com.demo; public ...
Hind Forsum's user avatar
  • 10.5k
1 vote
1 answer
285 views

CSS not loading in Spring Boot when running from jar

I built a fat jar and when running it from a command line, no CSS loads. java -jar -Dserver.port=9000 target/1or2clicks-0.0.1-SNAPSHOT.jar If instead, I simply run the psvm in my IDE, it works fine. ...
stanlick's user avatar
  • 1,462
1 vote
2 answers
3k views

IntelliJ Maven and JavaFX

I am new to IntelliJ and Maven and have, as seems customary by now, encountered a problem. I have made a Maven project within IntelliJ which runs well from within IntelliJ. When I do a clean install ...
Ivar Eriksson's user avatar
1 vote
0 answers
18 views

library that contains different files which more than one of them has main() method

I have added a jar file to my java project that contains different files which more than one of them has main() method.i want to know which main() runs first when i run the project.
omidXxX's user avatar
  • 147
0 votes
2 answers
3k views

Run a testNG test suite with a jar / no runnable method

I need your help ! At work I'll need to automate tests to test an entire application. Point is, I am beginner at Java and at automation. I am trying different tutorial and it works good. But now, I ...
Celia's user avatar
  • 7
0 votes
1 answer
437 views

No main manifest attribute, jar file, Applet

When trying to open my exported project (jar file) I get an error message No main manifest attribute, in file.jar. My project is basically a simple class extended by Applet, but the file won't open....
sagi saadon's user avatar
0 votes
0 answers
53 views

Run soap tests from Main class

I have maven project, which contains xml description of soap-tests (they generated from SoapUI Pro) in the root directory. I'm trying to create executable .jar file with Main class. But I don't know ...
Aleksey  Krekotnev's user avatar
5 votes
2 answers
9k views

IntelliJ build wrong JAR: Could not find or load main class

I have a simple example public class FileSystemReadFile { public static void main(String[] args) throws IOException { System.out.println("Reading the file" + args[0]); } } which is ...
laggerok19's user avatar
0 votes
0 answers
70 views

Parameter in the main Method in Java

When i run a .JAR ( for example) by the cmd , i can pass the following code : Arg1 Arg2 Arg3 , that will be used by the String[] args parameter. As I can pass any number of strings in this way, then ...
themagiciant95's user avatar
0 votes
1 answer
304 views

No main manifest attribute after creating jar, Cmd Windows

I want to create a jar from command line in Windows with this script: cd Mongo-SQL/src javac -cp "..\\lib\\*;..\\lib\\hapi-lib\\*" *.java FHIRTranslate\*.java jar -cvfm ..\\lib\\runSQLSave.jar ..\\...
Dorin's user avatar
  • 2,256
0 votes
1 answer
279 views

Adding Class-Path (sqljdbc4) to manifest file makes JAR unable to find/load main class Main

I've been having some strange problems with JAR creation from my project lately. I've been writing a simple Swing-application, a database frontend, but have not been able to build it as a jar through ...
magc's user avatar
  • 11
1 vote
1 answer
724 views

Error: Could not find or load main class Main when trying to run JAR. Manifest and classpath look fine, still doesn't work?

I've been writing a small system for my job in IntelliJ, building Jars with dependencies as I went along, to check if I could build it in a way that would let it run outside IntelliJ. One day, the Jar ...
magc's user avatar
  • 11
1 vote
0 answers
131 views

Cannot create JAR file-Main method not found

I'm trying to create a JAR of the given class. I am using a tool called JARBuilder as Eclipse was of no help in creating JAR files. When I try to create the JAR, it says that main method could be ...
Prashant Pandey's user avatar
-2 votes
2 answers
2k views

Java main method not recognized in jar file, but compiles fine

The first thing I'd like to point out is that I don't use IDEs. I use Notepad++ which has minimal assistance and I compile and run all my code from bash or DOS. In this case, I'm attempting to run a ...
邪悪歌's user avatar
1 vote
1 answer
123 views

Jar with multiple main

In one package I have two different classes Client.java and Server.java I want to make this package jar, i mean executable. First I want the Server class to run and after 2-3 seconds I want Client ...
elli's user avatar
  • 1,169
0 votes
0 answers
98 views

No main mainfest attribute in jar file

Hi I have downloaded one browser mob jar file which I have to load for my test cases I run this by following command: java -jar browsermob-rest-2.1.0-beta-2-sources.jar But here it gives me an error ...
sakib keriwala's user avatar
0 votes
2 answers
224 views

How can I run a java program from a java program? [duplicate]

I would like to write a java program that can run an another java programs Main class in runtime. How can I do that?
Szalai Mihály's user avatar
5 votes
1 answer
10k views

'No main manifest attribute' while running JAR file built with Gradle

I wrote a small Java application using Gradle to build it. The app comes from this tutorial and contains 2 classes: HelloWorld (the main class) and Greeter. The build.gradle file contains 2 sections (...
user3855877's user avatar
-1 votes
2 answers
5k views

How to handle empty parameters in a main method java call

I would like to have a dynamic way of passing in parameters to a java main method call which is done via the Command Line(cmd) to a Runnable JAR file. At the moment my main() method takes 6 parameters ...
MisterIbbs's user avatar
1 vote
1 answer
277 views

From a jar file, calling the main method from a class that implements a class from outside the jar

Suppose I have a jar file called 'MyJar.jar' with a class defined like this: import SomeInterface; public class MyClass implements SomeInterface { static public void main ( String args[] ) { ...
Michael Hudson's user avatar
23 votes
2 answers
40k views

Create Jar Library Without a Main Class

Today I have just created a Java Library. I created it using a Main class, since IntelliJ IDEA 14 asked me to add one. However I want it to be a normal library, without any Main classes. Is it ...
Thibstars's user avatar
  • 1,083
53 votes
17 answers
187k views

Maven Error: Could not find or load main class

I'm using a Java Maven program and I don't know what to enter as the <mainClass>. I've tried all kinds of things based off of numerous stackoverflow questions, but they are not solving the ...
MLMLTL's user avatar
  • 1,549
1 vote
1 answer
2k views

Setting a path for the main-class in the manifest file

Say for example my manifest.txt file is saved in a parent directory of my bin directory where by classes are saved. Now, I want to be able to refer to my main-class in the manifest header so that I ...
Omar Sharaki's user avatar
3 votes
0 answers
1k views

Class is present in JAR, but still "Could not find or load main class"

I downloaded and installed UMD's FindBugs 3.0 in /usr/local/share/findbugs-3.0: $ ls /usr/local/share/findbugs-3.0/ FindBugs.jar I have a little script to run it: $ cat ./findbugs FINDBUGS_HOME=/...
jww's user avatar
  • 102k
-2 votes
1 answer
39 views

Program runs in eclipse, but not in .jar form

I ran it in cmd and it said no main manifest attribute in, JGame2.jar how do i show it where the main is?? it works fine in eclipse.
Noah's user avatar
  • 19
0 votes
2 answers
480 views

Run program java with attributes from command line [duplicate]

I generated (in eclipse) test.jar file from a simple code: package testJawka; public class VarArgsDemo { public static void main(String[] args) { if (args.equals("1")){ System....
Wojtek's user avatar
  • 27
0 votes
0 answers
119 views

Running a jar file(not a runnable jar)

I just downloaded a mobile app jar from mobile9.com,I tried running it but then found out it wasnt a runnable jar. So I would like to know is there a way to find out where the main is located in the ....
Santino 'Sonny' Corleone's user avatar
0 votes
1 answer
824 views

Running jar file and Calling a method from main method in java

I have made a JFrame application in which i have made a method and added a button with button click event.Now i have called this method from button click as well as from main method .As per my need i ...
vikas's user avatar
  • 483
1 vote
1 answer
106 views

How to manifest Main using Eclipse?

I tried to export a runnable Jar, but it did not execute. The problem was could not find main method for given launch configuration However I did specify the Main class in the launch configuration. i ...
Andrei Vasilev's user avatar
-1 votes
1 answer
80 views

Main has no effect on JAR

I have the following code in main class it works if i run the program through netbeans. But when i open the jar made by netbeans it seems as if i had not written anything in main except the new ...
Daksh Shah's user avatar
  • 3,083
0 votes
1 answer
78 views

Find Main Class of referenced jar

A JavaFX application (jar) is referenced as an dependency in my project. The "Main Class" in this jar contains the main method and the start method, to run this application. Now i want to find this "...
AKR's user avatar
  • 531
1 vote
6 answers
680 views

Doesn't find my main class in a jar

I'm developing a program with three classes and also includes some external jar archives and classes. When I run it in Eclipse it works properly, but I need to try with some other programs, so I need ...
user2622471's user avatar
0 votes
4 answers
2k views

Call a method of running jar from batch

i have a Java application, which's main-function is called from a batch file witch 2 parameters. Now i want to pass another pair of parameters to the same app and not open another instance. Is it ...
Maik Fruhner's user avatar
3 votes
2 answers
12k views

"Error: Could not find or load main class com.mycompany.App" when trying to execute Maven-generated Jar

I'm trying to build a maven java program on on Windows7 and my java -version is 1.7. I'm getting this error: "Error: Could not find or load main class com.mycompany.App" when trying to execute ...
Ian Walter's user avatar
0 votes
2 answers
2k views

How to create a jar file with an Ant script to launch the program [duplicate]

I've currently got an eclipse project with two main methods and was wondering if it's possible to create a jar file which runs an Apache Ant script when the jar file is executed. I've provided an Ant ...
user1087943's user avatar
5 votes
7 answers
8k views

execute jar without a main?

Can I execute a jar file without having a main class, in this way: java -jar my_jar.jar -getX arg1 arg2 ... Knowing that I have a method called getX with takes arg1 arg2 ... as arguments. Any idea?
TheForbidden's user avatar
  • 1,573
9 votes
3 answers
16k views

How to Run a specific Main class from a jar

I have a jar file having 2 java classes both having Main methods. Is there a way I can specify while running the jar file, which class to call ? I know that manifest file can be modified to specify ...
Swagatika's user avatar
  • 3,416
3 votes
5 answers
5k views

Jar file created with Eclipse: Could not find the main class: UI.MainWindow. Program will exit

I have a Java application developed with Eclipse. I have tried to export it as a .jar file, to run it indipendently, but if I try to run it with the command java -jar application.jar I get this ...
DavideChicco.it's user avatar
0 votes
1 answer
434 views

Jar Maker -- Which is the main class?

Alrighty, so I'm working on making a .jar for a client for a little game and I know how to use everything and have done this before, on windows, now i'm on a mac. This shouldn't make a difference but ...
Sully Brooks's user avatar