I have recently migrated my project from Java8 to Java17. I wanted to try out the module system and added a module-info.java to my existing Eclipse project. As it caused several issues, I decided to revert back the change and to proceed without declaring modules. I deleted the file, but now I am getting compile errors. It is stated that LibX11 and libvlc_instance_t cannot be resolved to be a type and that they are not accessible. Why is that? It was working fine before. It seems that adding and removing the module-info.java has somehow messed up my configuration.
I need to access libvlc_instance_t because I need to subclass MediaPlayer, which requires a reference to libvlc_instance_t in the constructor. If libvlc_instance_t is really not meant to be used, how can I solve this? Thank you!
Related
I am trying to build a dynamic web project - if I add the Tomcat as a dependency, it does compile just fine. However, I have run into a peculiar situation that doesn't resolve properly.
Obviously I have many references to servlet-api.jar in my code for things like HttpServlet. Eclipse complains that it can't find HttpServlet and yet when I ctrl+click HttpServlet it recognizes that it lives in c:\programs\tomcat\lib\servlet-api.jar - how can it know that it's there during editing and yet not during build/compile/export?
Ctrl+Click works by different rules. Because of the way the type indexing works, it doesn't attempt to fully qualify the type you're hovering over if the reference is not already fully qualified, so it will still match types of the same name in different packages. It's faster, and usually doesn't cause confusion.
I am on Intellij 2016.2.4
I have imported a project from Git (I am new to that). I do now want to run a Module. I added to this Module every other Module Dependency and JAR Files needed. Their Scope is Compile.
The project is running for others without changes.
If I make the Module I get:
java: cannot find symbol ; location: class utils.MyRandom
The method which cannot be found is in the other Module. Interestingly, if I click on the Classname and go to the definition, Intelij does decompile an .class file for that Class, and that file is missing two methods - those which cannot be found.
Furthermore an other Module needs that Class. But not the same Methods! If I make this Module it succeeds, but if I add for testing purposes the Methods, which are not available in the other Module, they do not work here too.
I have seen that there are already some Questions about that here, but there Answers doesn't help me.
The "wrong" Class is in COMMON. While any is not working here, other Methods from that Class are working in CLIENT.
Seems like the dependency for the module where you are calling the method, MyRandom is not properly defined,which is usually a issue when git repo is cloned, when some IDE specific dependencies are ignored while pushing.
This might be conflict due to cache.
Go to File -> Invalidate Caches/Restart.
This should work.
Thanks
This is a weird situation. I am creating a plug-in which utilizes the HANA SQL Editor for Functions .hdbscalarfunction. It uses the dependency: com.sap.ndb.studio.sqlscript.function. Now, when I try accessing the class ScalarFunctionMultiPageEditor it is not working due to access restrictions. I then tried editing the access restrictions by allowing access to the specific package for that class. However, I get a NoClassDefFoundError.
I then noticed in the plugin.xml of the com.sap.ndb.studio.sqlscript.function is that the package for ScalarFunctionMultiPageEditor is not exported, so this is not visible to anyone.
Any ideas?
Thanks!
If the plugin does not export a package then you cannot use anything in the package. The Eclipse/OSGi classloaders enforce this and you can't work around it.
I'm trying to instantiate an object using a class in an external jar. This is a jar that a team-member is developing and recently changed the interface methods.
The problem is that IntelliJ still thinks class constructor should take 4 arguments (the old interface) rather than 3 (new interface).
I can guarantee that the jar in the module dependencies is the new version. This is further confirmed by the fact that the code does successfully compile.
So my question is, why does IntelliJ still think I should have the old interface? Does it have some sort of cache that is not updating properly?
Attached screenshot demonstrates the problem.
Thanks.
Right-click on your project and select Refresh. Your project is using the compiled jar, which has changed, but your IDE is still using the old compiled jar as it was when it loaded it (even though the new source may be visible in the relevant project).
Eclipse has the same issue.
try move the cursor in the constructor, then press ctrl + b, it will jump to the declaration of constructor, which will get you a chance to double check if the constructor is correct or not.
also you can try "invalidate cache" under "file" menu, this will clear cache and rebuild index for your project.
Possibly IntelliJ's indexing info is out of date as it didn't notice that you switched a jar dependency.
This may be resolved at least by restarting the IDE, which then rescans and rebuilds indexes.
You can also remove all files from folders caches and index located for example here c:\Documents and Settings\User.IntelliJIdea\system\ (of course you may have another path) and try to start IDE again.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
NoClassDefFoundError - Eclipse and Android
I'm seeing this question is getting asked a lot in many different contexts. Perhaps we can set some strategies for locating and fixing it? I'm noobish myself so all I can contribute are horror stories and questions, sorry...
It seems this is thrown when a class is visible at compile time but not at run time... how can this happen?
In my case I am developing an app that uses the Google APIs, in Eclipse, for the Android platform. I've configured the Project Properties / Java Build Path / Libraries to include the gdata .jars and all is well. When I execute in the emulator I get a force close and the logcat shows a NoClassDefFoundError on a simple new ContactsService("myApp"); I've also tried a new CalendarService("myApp") with the same results.
Is it possible or desirable to statically bind at compile time to avoid the problem?
How could dynamic binding of an add-on library work in the mobile environment anyway? Either it has to be bound into my .apk or else I need to "install" it? ... hmmm.
Advice much appreciated.
It seems this is thrown when a class
is visible at compile time but not at
run time... how can this happen?
The build classpath may include JARs that are not being packaged into the APK.
Is it possible or desirable to
statically bind at compile time to
avoid the problem?
It is possible, desirable, and necessary.
Outside of Eclipse, you just put the JARs you need in libs/ in your project, compile with Ant, and you are done.
Inside of Eclipse, one pattern I have had students use with success is to put the JARs you need in libs/ in your project, add them as JARs to the build path (note: not external JARs), and they get packaged as part of the APK. Note, though, that I do not personally use Eclipse, and so my experience with it is limited.
For those having problem I was having the same error with my app. what I did to solve that was create a new project and copy my resource and source folders along with my manifest file into the new project (I deleted in advance those within the new project created) and voila.
When I got this, the problem was actually deeper in the queue; Dalvik converter had failed to convert some of the referenced libraries and still Eclipse allowed me to launch the project.
Check the Android SDK console to see if there are any errors reported.
In my case, I'm using my own library (MyLib) shared between 2 apps. App A was closed when I added a new class to the library.
When I opened App A to work on it, Eclipse recognised the new class, and I was able to reference it. However on running I got the error.
It turned out that the imported library folder in App A (named something like MyLib_src) didn't reflect the changes made to my library project (MyLib).
To solve this I refreshed App A, the changes reflected, and Android could build my project correctly.
I have found no reference to this version of the problem, so thought I would add it to this list.