0

This is my problem: I'm new at Java, I started a Maven project because I needed to use a lib that requierd that. Then I no longer needed it but keep going with the Maven project. Now I'm trying to build it but the .jar does not run the project when double clicked.
Since I don't know Maven very well (I found this but didn't understand it), I thought that the easiest way was to convert the proyect into a "normal" Java App project. So I copied all files with classes from the Maven project folder to a new Java App project folder manually.
It opens fine, but I got this error when retrieving an ArrayList:

Exception in thread "pool-1-thread-5" java.lang.ClassCastException: java.util.concurrent.CopyOnWriteArrayList cannot be cast to java.util.ArrayList

Since this doesn't happen in the Maven project I assume that it happens due to my archaic method to copy the classes...

So, is there a way to convert my Maven Project into a normal Java Project? I have found a lot of topics about doing the opposite but anything useful about what I need (only this but it is not what I need).

Thanks!

Community
  • 1
  • 1
Marcos
  • 21
  • 2

1 Answers1

0

You can try closing the project on NetBeans and importing a project from existing file system.

However I feel that is not the ideal way to do it, but it should allow you to run it as you require. Disabling the Maven nature is also viable.

According to Java Docs, java.lang.ClassCastException is thrown to indicate that the code has attempted to cast an Object to a subclass of which it is not an instance.

There might be a chance that you are getting that exception cause you are missing some library or class which implements the same interface or allows you to convert the object to a given type.