Questions tagged [mainclass]

92 questions
2
votes
2 answers

Problem running a Jar file

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…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
2
votes
0 answers

Eclipse: The project was not built due to "A resource exists with a different case: '/project/bin/License.txt'."

I get this error under the problems tab. I downloaded a project off of github then imported it to eclipse and added the libraries to the build path. When I try to run I get the error : Could not find or load main class…
Gratin
  • 113
  • 3
  • 15
2
votes
2 answers

Deploying netbeans applications - jar file error (could not find main class)

I have a small GUI application developed with netbeans. I used the 'clean and build' option to build an executable jar file. .jar file works in my pc. But when i sent the application to my friend he says that it throws 'cannot find the main class'…
PKay
  • 433
  • 3
  • 9
  • 20
1
vote
3 answers

Executing java class in JAR from a java program

My Question is: I have a test.java class which is the main class. There is one more class(non-main class) which is present in JAR file. Now i want to compile and execute demo class present in JAR from the main class present outside the JAR. Please…
old_soul_on_the_run
  • 279
  • 1
  • 6
  • 15
1
vote
1 answer

UML Diagram for methods in main class

I'm working on my project and wondering whether if I should represent all the methods in the main class as static by drawing a line under the name of the methods including the main method. For example: ------------------- …
1
vote
0 answers

Discord.JDA query

I am recently into discord.JDA and have been learning and trying to code my bot. I wanted to ask something about it as I was making the purge/delete command with the help of some source codes and my knowledge. My code does not give any error but my…
n1ckool
  • 11
  • 1
1
vote
1 answer

Why does "initializing Test Class" doesn't get print?

Can someone please explain why would TestClass constructor not getting called ? It works if I create an another class but not with the class containing main method ? public class TestClass { public void TestClass(){ …
1
vote
1 answer

Calling Spring Boot method from terminal

I am researching how to call a method from the terminal. @Component public class ApplicationAdapter implements CommandLineRunner { @Autowired private IApplicationPort iApplicationPort; @Override public void run(String... args)…
ken4ward
  • 2,246
  • 5
  • 49
  • 89
1
vote
1 answer

Facing issues while executing Java through Linux: Could not find or load main class

I am trying to run the java code from Linux and struggling with error "Error: Could not find or load main class". i have main code "CompareTableCachedRows.java" in "/home/user/test/comp/code" directory which i am able to successfully compile and…
1
vote
1 answer

Why does ant Manifest task split long main class name?

The following is my Ant build file contents:
Linus Fernandes
  • 498
  • 5
  • 30
1
vote
0 answers

getting error 'Could not find or load main class' on executing jar file created using intellij

I'm developing a Java-based app using Java8, JavaFX, and some other third-party libraries in IntelliJ. My project directory looks like this Everything is working fine until the execution of JAR file. When I'm trying to run same using command java…
1
vote
1 answer

Could not find or load main class com.google.devtools.build.android.desugar.Desugar android studio

i am getting error "Could not find or load main class com.google.devtools.build.android.desugar.Desugar" in my android studio 3.0.1. i know it's kind of duplicate question but i had look for proper solution but i didn't get solution. I had tried…
Jaydip Kalkani
  • 2,493
  • 6
  • 24
  • 56
1
vote
2 answers

Is "main.class" XML element required in Maven's pom.xml if the artefact is a library?

I'm creating a pom.xml for a project that is a library. Is POM XML element under required for this? (the library has a small test Main.java which I didn't really intend to include in the library JAR file in the first place,…
DVK
  • 126,886
  • 32
  • 213
  • 327
1
vote
2 answers

send argument to main class by command line with external jar command

I run java application in command line linux with external jar like this : java -cp ".:commons-net-3.6.jar" FtpClass how can I send argument to main class by command line ?
Saeed Aliakbari
  • 281
  • 4
  • 20
1
vote
1 answer

Setting mainClass in spring-boot-maven-plugin causes me to need to set the 'defaultServletName' property explicitly

I had a springboot jar working well, until I added newrelic-agent jar to the classpath, now I need to specify a main-class. This makes sense because I now have several classes with a static main args method in the classpath. The recommended way to…
cosbor11
  • 14,709
  • 10
  • 54
  • 69