Eclipse - The import javax.jws cannot be resolved - java

I have imported recently in my code the packages javax.jws.webService and javax.jws.webMethod, the first time i launch my code the import works, but when i came back, this error appeared.
I have java 1.8
I tried to restart Eclipse, but it doesn't work.

Related

The import jdk.nashorn cannot be resolved

I am trying to import a project into my eclipse workspace. When I maven updated the project, this dependency is not getting downloaded.
When I searched online, I found that jdk.nashorn is not supported from java 11 onwards. But I am using java 1.8.0_231, still its not working for me.
The code uses below class from the library.
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
ObjectSizeCalculator.getObjectSize(modRespList)
Is there any way to make this code work?

Android Studio can't resolve any Java objects but builds and deploys APKs that run

My IDE editor is full of errors, it cannot resolve Java objects of any type, even something as basic as a String. In spite of the huge mass of red lines and error flags all over my code, it still builds and deploys working APKs. Of course if I get a real error I will never know as it will be buried by all the other errors.
Here are some imports that Android Studio cannot resolve:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
I have tried uninstalling as much as I could find and re-installing, and trying to match the correct gradle components (the part which I find most difficult and confusing) for 4.2.0. Most of these attempts were based upon posts of what looked like similar problems from this site. They were often several years old.
I use the gradle wrapper. I also have IntelliJ installed and do not know if that is causing the problems. It hasn't for the last couple of years. I am at a total loss. Anyone have some idea what is going on?
Is there a way to clean out EVERYTHING without deleting my projects and restart?
There are two things that usually help in situations like this:
File -> Invalidate Caches/Restart
If (1) does not help (wait for all the indexing to finish) you can also quit AndroidStudio and then delete the .idea folder in your project. If your project is set up with gradle, this does not hurt, as you only lose some minor project related IDE configs (maybe back-up the folder if you are unsure.
AndroidStudio (or IntelliJ in general) screws up its caches and indexes sometimes. This seems to be happening more often lately. The two approaches above mitigate that by making sure all caches and indexes are rebuilt for the project.

Trouble with importing MathParser external library in IntelliJ

as above, I cannot get access to classes of external library MathParser imported with Maven in IntelliJ. I've configured pom.xml file and enabled auto-download, so (as seen on the bottom of Project files section) it got downloaded, but when I try to use classes/import with import org.mariuszgromada.math.mxparser.*; - auto and manual import do not work.
Here's a screenshot of current situation
Any ideas?
Created new project for this test purposes, but same thing is happening. In ,,External Libraries" (in project files on the left in the screenshot) the lib appears , nevertheless no way to access to it's classes.
Update:
1) I've deleted jdk, and downloaded the newest 10'th - no results.
2) Reinstalled IntelliJ IDE couple times, same. Also I've tried to set up IntelliJ on Windows in VirtualBox (I need to finish my short project), same with jdk 10, and finally it worked. Nevertheless, I need to make it work without externalising from macOS (also, friend of mine with Mac, didn't have any similar problems). Totally same procedure, but on the macOS side on my Macbook I cannot import anything from this exterbal library (what is possible on virtualised Windows side).
3) I was trying to clean my Mac out of IntelliJ folders, then uninstall it, then imported settings from ,,healthy mac's IntelliJ" - still nothing new.
Solution:
I've reinstalled macOS, and finally that's how I've solved the problem.
Everything seems to be correct. You can try to
directly import of mxParser by changing import to import org.mariuszgromada.math.mxparser.mxParser or
check which classes you have in that package by pressing Ctrl + Space after mXparser package in import statement.

Android studio cannot resolve symbol common, missing from android.gms package

I'm making a game where I'm using Google Play Services. I recently switched from eclipse to Android Studio (now running 0.8.14). In android studio I added a "Google Play Services Activity" and had my game class extend that class. I left the services class without modification. The project compiles and runs just fine but the IDE is filled with errors because it "cannot resolve symbol 'common'" and "cannot resolve symbol 'games'"
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
Any ideas on why this is and how to fix it?
I have attempted to reimport my project after deleting all .iml files and the .idea folder without result.
[EDIT]
As per request I'm adding a screenshot of the errors:
[EDIT 2]
I've kept searching for solutions and while I have not found any, I now have a screenshot that may be a bit more helpful.
As you can see, the com.google.android.gms package seems to be missing the common and games package.
I have tried updated gradle, tried using JDK 1.7 instead of 1.8 and attempted syncing with gradle multiple times. I will keep searching for an answer but if you have experienced this before, please feel free to help me and others out.
Add this to your build.gradle
dependencies {
compile 'com.google.android.gms:play-services:5.0.89'
}
Finally I found the real problem. Apparantly, my project was contained in a folder that ended with an exclamation mark. (myProjectName!) This caused Android studio to fail in finding certain imports.
Solution: I renamed my project from myProjectName! to myProjectName and moved the whole project to a new folder without the trailing exclamation mark. This seems to have fixed everything.

draw2d imports not resolved

I am doing an eclipse plugin using gef. When I restart eclipse after a plugin installation I got a lot of errors regarding draw2d imports. For example in one of my classes I had:
import org.eclipse.draw2d.ImageFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.MouseMotionListener;
the 3 last imports were fine but the first one "import org.eclipse.draw2d.ImageFigure"
could not anymore be resolved.
I can not figure out what is going wrong. Any ideas?
Do you have org.eclipse.draw2d in Required Plug-ins(plugin.xml -> Dependencies)? If no - add and try to rebuild plugin, if yes - ... remove and add once again?
Ok I finally found the solution. The plugin was using its own version of draw2d.jar file. I manually replace that file with the draw2d.jar from the eclipse GEF plugin and everything was working fine again.

Categories