Error on Intellij Idea when trying to run a kotlin project - java

Im getting this error. What I was doing was the code I want to run didnt run rather it showed up the Edit Configurations
The error: Failed to download Amazon Corretto 18.0.2. EventQueue.isDispatchThread()=false Current thread: Thread[ApplicationImpl pooled thread 110,4,main] 2031890033 SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 1808191328
This was what I was trying to fix: Image Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Array'. Check your module classpath for missing or conflicting dependencies
And it says that the JDK "corretto-18" is not found on the disk or corrupted.
Im using: IntelliJ up to date, Java 18
Does anyone has a solution for this issue??
Thanks-

Related

Eclipse build issue

I am trying to build a project into Eclipse and I'm getting this error message on compiling Scala file and this is error I'm getting:
'The method size() is ambiguous for the type SortedSet'
There are this dependencies inside pom.xml file:
<org.scala-lang>2.13.0</org.scala-lang>
<com.typesafe.akka>2.6.18</com.typesafe.akka>
<com.lightbend.akka>1.0.7</com.lightbend.akka>
Project is using Java OpenJdk 1_8_u333.
Does anyone know how to resolve it?
I've been looking and found there was bug in Eclipse with ambiguous method calls which seems still present:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=468276
I've tried to avoid it by adding this parameter to eclipse.ini file, but it doesn't work:
-DtolerateIllegalAmbiguousVarargsInvocation=true
Error doesn't occur when I change compiler to Java 7, but I can't avoid this error ... the second way to avoid it is to call exact method name iterator().size()
Note: I tried same code in IntelliJ with same JDK and there was any errors ... any suggestion would be very helpful.
Thanks in advance!

NoSuchMethodError with Camel RouteDefinition class

I am trying to debug a Java / Maven project with a lot of depencies on various libraries.
When I run it on a Linux server the program starts up fine, but when I try to run it in Eclipse it throws the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.camel.model.RouteDefinition.getErrorHandlerBuilder()Lorg/apache/camel/ErrorHandlerFactory;
at org.apache.camel.spring.spi.SpringTransactionPolicy.wrap(SpringTransactionPolicy.java:69)
at org.apache.camel.model.PolicyDefinition.createProcessor(PolicyDefinition.java:133)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:437)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:183)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:817)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:697)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1654)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1441)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)
Now, I can see that the RouteDefinition class is in the camel-core-2.9.3,jar and I can see that this library is imported. So how come it doesn't see that method?
How do I go about debugging this?
Could I get info from the process running on the Linux server? For example can I get the list of Jars that are imported and the order in which they are imported?
Many thanks!
The error that you're getting is caused by Maven pulling in the wrong version. Try deleting all versions out of your local repo, add it explicitly to your pom, clean out all of your builds, pray to the eclipse gods, etc. If it still gives you the error, check your local repo to see which wrong versions it pulled in, figure out what depends on them, and add explicit ignores for them while keeping the explicit include.

JavaFX for Android - gradle build property not found

I am using this guide to try and port my JavaFX application to Android.
I have downloaded and installed all the things that the guide says I need but when I run the command:
gradle -PDEBUG -PDIR=/home/josh/cs335Android -PNAME=AndroidTimeline -PPACKAGE=src -PJFK_SDK=/home/josh/android-sdk -PJFX_APP=/home/josh/git/TimelinePhaseTwo -PJFX_MAIN=src/gui/Driver createProject
it says:
A problem occurred evaluating root project '***android-tools***'.
Cause: Could not find property '***ext***' on task '***:conf***'."
I think this is because I am not properly supplying the parameters to gradle (as described in the guide) but I don't actually know how to do that. Are those something that I write in the build.gradle file?

NO java.lang.NoClassDefFoundError error in Eclipse

I have a project in eclipse which was working fine untile a few minutes ago. I added a JDBC driver ad tried to run it, now even previous runnable file are giving me
Exception in thread "main" java.lang.NoClassDefFoundError: sample
Does anyone have any idea why it is happening does it have anything to do with the jar?
I have even removed the jar.
Try following, one by one
If you are using libraries, check whether everything is included to the project properly.
Rebuild the project
'worked few minutes ago' means it used to work. Did you add any new code? Then the error is there, check whether those codes call other classes, and whether they are available
Restart IDE
Once I used the following to solve the same issue
http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html
If all above failed, that may be due to crash in JVM. I have experienced that as well.

Eclipse ClassNotFoundException

Everything works fined, but suddenly eclipse stopped execute and junit tests or even main method, when i run them using run as - > Java application, run as -> junit test
It simply throws error
Caused by: java.lang.ClassNotFoundException: package.ClassName
whene ClassName - is class from where i trying to run method main.
It affect only one of my projects ... Different workspaces works fine, other project in same workspace works fine as well.
I'm sure if i recreate current project, error will gone. But the adjustments of this project in eclipse is really hard, so i want to avoid it.
Any clue?
The ClassName is not in the Class Path, if you start from console you should use -cp parameter , if from eclipse, please add ClassName to the sources of current(start) project.
Thanks to adarshr, I was able to look at the Problems window and determine that the build was failing because it could not find a class I had written.
I had used the MS TFS plugin to create a "shelveset" and it was supposed to have removed my pending changes in the process. However, this integration with the TFS snapin and Eclipse is obviously not well implemented, since the Eclipse project still thought the file existed and was complaining that it could not be compiled.
I went and manually deleted those "files" or "non-existing files" from the Eclipse project (that I thought I had removed with the shelveset action) and the problem was solved.
Also....
Another annoying things is that the Tomcat error I was getting by trying to debug within Eclipse was like this:
SEVERE: Error configuring application listener of class
com.CompanyName.ProjectName.servlet.StartupConfigListener
java.lang.ClassNotFoundException:
com.CompanyName.ProjectName.servlet.StartupConfigListener at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
In reality, there was no problem at all with StartupConfigListener.java!! The build failed due to the OTHER problems I mentioned above, and therefore I guess this was the first class it attempted to load and failed.... because the entire project hadn't been able to compile perhaps?
(Here's to hoping my next project is using Visual Studio instead of Eclipse!)
Ok, I finally figured it out. The problem was with installed JRE in eclipse setting. I was playing around with this setting and changed installed JRE to JDK, and for some reason it broke the eclipse project.
You can also try going back to the basics. Check your command line and VM args. I've had this situation where a VM arg I was passing in was a path to a file that had a space in the path, and I had forgotten to include the full path in quotes. So e.g., if my arg looked something like
-DFILE=C:\Documents and Settings\myfile
...I'd get a java.lang.NoClassDefFoundError caused by a java.lang.ClassNotFoundException.

Categories