So, in my case, the correct command is java cvfe App.jar App -C target/classes. The simple solution is to list the folders you want to add with the -C option instead of using the default way of listing folders. This could be solved by creating the jar directly from the target/classes directory, using jar cvfe App.jar. This is because the packages inside App.jar don't match the actual packages in the project. If you try to run this jar with java -jar App.jar, it will complain that it cannot find the App class. This doesn't work, as the newly created App.jar will have the class App.class in the directory target/classes. I was trying to package it with jar cvfe App.jar target/classes App, from the root directory of my project, as my App class was in the default unnamed package.
Could not find or load main class intellij jar license#
I had all my compiled class files in target/classes, which are not packages in my case. Could not find or load the main class in Java SolutionInner Light by Kevin MacLeod is licensed under a Creative Commons Attribution license (https://creati. java -Xmx1024M -Xms1024M KCauldron-1.7. pause. Stack Exchange network consists of 178 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. However, Corral's comment on Ryan Atkinson's answer did tip me off to the problem. INFO: Initializing ProtocolHandler ġ0:14:00 AM .I know this is an old question, but I had this problem recently and none of the answers helped me. Make sure your CLASSPATH Environment variable is correctly set or your JDK home is added properly in classpath.
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the : /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/libġ0:14:00 AM init If you are running a Java based application from Eclipse or Intellij and you are getting the Error:Could not find or load main class. INFO: Command line argument: -Djava.io.tmpdir=/opt/tomcat/apache-tomcat-7.0.82/tempġ0:13:59 AM .AprLifecycleListener lifecycleEvent INFO: Command line argument: =/opt/tomcat/apache-tomcat-7.0.82 INFO: Command line argument: -Dcatalina.base=/opt/tomcat/apache-tomcat-7.0.82 INFO: Command line argument: =/opt/tomcat/apache-tomcat-7.0.82/endorsed INFO: CATALINA_HOME: /opt/tomcat/apache-tomcat-7.0.82 INFO: CATALINA_BASE: /opt/tomcat/apache-tomcat-7.0.82 INFO: Server version: Apache Tomcat/7.0.82 Using CLASSPATH: /opt/tomcat/apache-tomcat-7.0.82/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-7.0.82/bin/tomcat-juli.jarġ0:13:59 AM .VersionLoggerListener log Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-7.0.82/temp Using CATALINA_HOME: /opt/tomcat/apache-tomcat-7.0.82 Using CATALINA_BASE: /opt/tomcat/apache-tomcat-7.0.82 Could not find or load main class java jar 00:31 Could not find or load main class java jar 00:31. Output of catalina.out tomcat]$ cat /var/log/tomcat/catalina.out
Server B - Doesn't (Even though indicates "started") Using CATALINA_BASE: /opt/tomcat/current Using CLASSPATH: /opt/tomcat/current/bin/bootstrap.jar:/opt/tomcat/current/bin/tomcat-juli.jar Using CATALINA_TMPDIR: /opt/tomcat/current/temp Server A - Works Using CATALINA_BASE: /opt/tomcat/current The server was installed using downloadeded binaries, custom init script, etc using an Ansible script that worked on 3 servers in total (all same OS, Java) thus far. IntelliJ: Error: Could not find or load main class. Error: Could not find or load main class HelloWorld Caused by: : HelloWorld. However, one server doesn't want to start. Scala jar: Error: Could not find or load main class. In my case, I have these two servers configured identically (AFAIK). Most hits on google seem to indicate a specific class at the end of the log entry. Notice, no specific class specified at the end of the log entry. When I attempt to startup Tomcat (7.0.82) on RHEL6/Java7, the logs will display this: