I knew there are similar question posted already but none of it helped in resolving my issue. Currently I am working on a Scala project using eclipse.
Issue 1 : Unable to get Run As -> Scala application
Issue 2: When I run my program through Run Configurations, getting the following error
Error: Could not find or load main class NewStreaming
Code :
src/main/scala/NewStreaming.scala
object NewStreaming {
def main(args:Array[String]): Unit = {
...
...
}}
Issue 3: Able to do "mvn package", but when I execute the jar in hdp, with spark-submit, getting the following exception
java.lang.ClassNotFoundException: NewStreaming
Could you try to do a Rebuild / Clean of your Project? :)
I didn't use eclipse since a while. But I remember I got a problem of that kind.
Related
I don't know if this question has been asked/answered yet. If so, I'm sorry. But I'm new to IntelliJ and there's a lot of foreign words I yet need to understand.
My problem is as follows:
I installed the complete IntelliJ package, created a new Java project and created a new class inside my src folder:
package de.itsme.hello;
public class Hello {
public static void main(String[] args) {
System.out.println("Hello");
}
}
So I try to run it and I get this Error:
Error: Could not find or load main class cucumber.api.cli.Main
Caused by: java.lang.ClassNotFoundException: cucumber.api.cli.Main
I tried adding cucumber-core:4.0.1 to the project's dependencies but then I got another exception:
Exception in thread "main" cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH.
at cucumber.runtime.BackendModuleBackendSupplier.get(BackendModuleBackendSupplier.java:39)
at cucumber.runner.SingletonRunnerSupplier.createRunner(SingletonRunnerSupplier.java:38)
at cucumber.runner.SingletonRunnerSupplier.get(SingletonRunnerSupplier.java:32)
at cucumber.runtime.Runtime.run(Runtime.java:75)
at cucumber.api.cli.Main.run(Main.java:26)
at cucumber.api.cli.Main.main(Main.java:8)
I don't need cucumber or at least not for now. Is there a way to make it either work or remove it from the project?
Thanks in advance!
Maybe you have the packet JDK installed incorrectly and this produces you an error. Or maybe your classspath is incorrect.
I saw this link which uses Instrumentation to calculate the size of objects during runtime. I decided to try this library since It can be really helpful in determining the size of big data structures.
So I wrote the following code in a new project named TrySizeOf using NetBeans IDE:
package trysizeof;
import net.sourceforge.sizeof.SizeOf;
public class TrySizeOf {
public static void main(String[] args) {
String s = "abc";
System.out.println(SizeOf.deepSizeOf(s));
}
}
After that I created a folder named lib inside my project, and placed SizeOf.jar in it. Then under Project->Properties->Run I placed the following parameter:
-javaagent:/home/MyUserName/NetBeansProjects/TrySizeOf/lib/SizeOf.jar
However, when I attempt to run my project I get the following error:
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : /home/MyUserName/NetBeansProjects/TrySizeOf/lib/SizeOf.jar
agent library failed to init: instrument
Can any one help me with this? or maybe explain what did I do wrong?
UPDATE:
I found the error, it was a problem with the upper and lower cases. When I started the project for the first time I made a little upper and lower case typo. When I paid attention to it I fixed it, but I kept getting the same error (However the path was fixed). Now, I tried using clean and build and the project worked. It was that when I do a clean and build manifest file gets updated which is used to specify the path of premain method. When I tried clean and build the file got updated and the project finally worked. Thanks for the comment about a typo in my post, which somehow made me think about this.
When I run my class as a TestNG Im getting below error,
Error:
Could not find or load main class 0.
But when i run the class with normal java main method it is working fine.
Can someone please help me.
After installing the m2e plugin from eclipse it worked.
I have tried to create the testing framework using this tutorial
While executing the code, I am getting the below exception. Please tell me what I need to do with my code and Java configuration.
org.testng.TestNGException:
Cannot find class in classpath: sampletest
Do you use Eclipse? Try Project->Clean and run again. I have seen similar behaviour before for various users.
I have the following setup, grails 2.0.3, STS, and I'm doing this in one of my controllers:
render(['car': contactL] as JSON)
When I run the application I get the following error:
I have read about the error, but none of the solutions have worked for me, I have tried cleaning, upgrading, using the Grails Tools -> Refresh dependencies but it gave me:
grails> | Error Error running script null: Cannot invoke method trim() on null object (Use --stacktrace to see the full trace)
I'm also getting this error in my project:
The project was not built since its build path is incomplete. Cannot find the class file for groovy.lang.GroovyObject. Fix the build path then try building this project Ristretto Unknown Java Problem
What's you diagnose?
To fix the "unable to resolve class JSON" error, you should just have to import it:
import grails.converters.JSON
...
class MyController {
...
render [car: contactL] as JSON
I finally managed to get it working, I switched workspace, and added my project - problem solved.