Cannot resolve symbols for Vaadin - java

I installed Vaadin on IntelliJ, using the trial mode of 14 days. I created a Vaadin 8 design including several UI components, yet they cannot be resolved. In particular, for these lines of code
import com.vaadin.annotations.AutoGenerated;
import com.vaadin.annotations.DesignRoot;
import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.CustomComponent;
I get the messages 'Cannot resolve symbol ui' and 'Cannot resolve symbol annotations'. The lines were automatically generated after I created the .html file of the design, along with the lines
#DesignRoot
#AutoGenerated
in my code. That means I have a vaadin package than can be located, yet it doesn't include the annotations and the ui components. What am I supposed to do?
Thank you in advance
PS: I am using Fedora, if it plays any role

Related

VS Code - The import "#####" cannot be resolved

So, i am running a java project which have many library that are available in the current working directory but VS code seems to not recognize these library and giving out error "The import ###### cannot be resolved" ex: The import org.apache.pdfbox.pdmodel.PDDocument cannot be resolved"
here is the image that might help you to know more about it
This is the package that i am working on :
Here the org/apache is the library contain the class file that are need to be imported and FileArrangement.java is the file having the import statements
Error i have been receiving
this is what VS code is been showing
i really need your help because i really don't have any idea how to correct this
I have checked other projects and they are also showing the same result although the import statements for java classes like . java.util.ArrayList doesn't show any kind of error and i have tried to clean java in VS code it also didn't work
i just need to correct this error of VS code to import the classes that i need
No error on java.util package
Putting the libraries in your current working directory does not work for Java, you need to add them to the classpath.
If you're using maven, that manages the classpath for you.
If not, you can manage it in VS Code by executing the Java: Configure Classpath command from the Command Palette (Ctrl+Shift+P).
You can add dependencies via Referenced libraries under the JAVA PROJECTS panel.
Or use java.project.referencedLibraries setting in settings.json.
For example:
"java.project.referencedLibraries": [
"library/**/*.jar",
"/home/username/lib/foo.jar"
]
Details can be found in configure-classpath and manage-dependencies.

Minecraft Forge 1.16.5 changes since 1.16.4 - compiling error

I am trying to learn Minecraft modding, and while following a tutorial for version 1.16.4, I found that their code did not work, and I presume this is a change to the API, since I am using 1.16.5.
I have looked at both official and unofficial API docs, but these did not provide me any insight. Could anyone point me to a better API reference, or better yet, to a VSCode extension that autocompletes for the most recent Forge API.
Here is the compile error when I ran ./gradlew.bat build with my minimal reproducible example (sorry about the code highlighting, I don't know how to fix it):
C:\Users\eric\Desktop\Programming\Java\Minecraft Mod 1\src\main\java\com\ericl5445\testmod1\core\init\ItemInit.java:1: error: package net.minecraftforge.item does not exist
import net.minecraftforge.item.Item;
^
C:\Users\eric\Desktop\Programming\Java\Minecraft Mod 1\src\main\java\com\ericl5445\testmod1\core\init\ItemInit.java:2: error: package net.minecraftforge.item does not exist
import net.minecraftforge.item.ItemGroup;
^
Here is my full code:
TestMod1.java
ItemInit.java
Any help would really be appreciated!
I do not have an api reference, however I have found that the ItemGroup class is not under net.minecraftforge.item. It is under the package net.minecraft.item.
Your IDE, usually Intellij Idea or Eclipse, should be able to tell you where these classes are located via a search functionality. In Eclipse, you can press Control/Command + Shift + T to bring up a search box with a list of all the classes in your workspace.
The Package You Need To import is net.minecraft.item.Item and net.minecraft.itemGroup,
Not net.minecraftforge.item.Item and net.minecraftforge.itemGroup

Android JDK 7 wildcard imports

I am experimenting with developing Phonegap plugins for Android using the Phonegap CLI and JDK 7. Time and time again I have found that wildcard imports do not work and I have to explicitly import each class that I need to use. A case in point. I am currently playing with using Rhino to run JS without a WebView. The code samples I find out there suggest import org.mozilla.javascript.* which starts throwing up compiler errors as soon as I put in code that uses the Rhino Context etc objects. In order to be able compile correctly I need to do a whole series of explicit imports. e.g.
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.NativeObject;
Without such imports I end up with error messages along the lines of
cannot find symbol
NativeObject result = (NativeObject)
function.call(rhino,scope,scope,functionParams);
symbol: class NativeObject
Is this a constraint imposed by Phonegap or something that got introduced with JDK 7 (I assume that most of the sample code I am depending on predates JDK 7) or something else altogether. I can see how the Context object in Android can create a conflict here but I am equally certain that I am not accidentally using other classes that define Scriptable, ScriptableObject etc.
I'd be most grateful to anyone who might be able to clarify.

Importing UsbSerialPort, Hexdump, SerialInputOutputManager in Android Studio

I'm trying to use the 'mik3y/usb-serial-for-android' library in order to read a serial connection. When trying to use the example code, I get errors because of certain things that will not import.
Here are the import statements that I'm having issues with(I've replaced my name and project info with dummy data):
import com.mycompany.johnsmith.driver.UsbSerialPort;
import com.mycompany.johnsmith.util.HexDump;
import com.mycompany.johnsmith.util.SerialInputOutputManager;
I receive the error: Cannot resolve symbol 'driver' for the first import, and Cannot resolve symbol 'util' for the other two.
I've installed the library as a dependency and all of my other imports work fine, but I'm still not sure if the issue is because of the library.

Java library import difficulty

I'm trying to compile a small test program I have written for a raspberry pi.
The program makes use of the Pi4J library to control the piface add-on board.
What I have done so far is based on the following tutorial: http://www.savagehomeautomation.com/piface
While I can get the above example program to compile within my IDE after setting up the class paths I get compile errors with the one I have made and as far as I can tell the imports are set up in the same way.
It says that each of the following packages does not exist:
import java.io.IOException;
import com.pi4j.component.switches.SwitchListener;
import com.pi4j.component.switches.SwitchState;
import com.pi4j.component.switches.SwitchStateChangeEvent;
import com.pi4j.device.piface.PiFace;
import com.pi4j.device.piface.PiFaceLed;
import com.pi4j.device.piface.PiFaceRelay;
import com.pi4j.device.piface.PiFaceSwitch;
import com.pi4j.device.piface.impl.PiFaceDevice;
import com.pi4j.wiringpi.Spi;
I'm assuming that my problem is relatively simple but I don't really understand how import statements work and it's quite vague topic to search about. I have included some file paths if that helps.
This is where my project resides:
/home/pi/JBerries/relay
and this is where the pi4j library is:
/opt/pi4j
I hope the following image provides some of the information requested, note that the class paths are already set up:
You need to set the CLASSPATH environment variable to /opt/pi4j or the jar file therein. WIthout this the compiler is unable to know where your libary is located and will give you the errors you describe.
If you're using a project in JBerries you need to configure the classpath for the project - the screenshot shows the classpath for single-file compilations only. To edit the project config right-click the root node in the project window and select properties.

Categories

Resources