I am trying to generate QR-Codes in Java with the QRGen library and ZXing. I followed the instructions on this stackoverflow question.
I included the following three libraries:
zxing-core-1.7.jar ,
zxing-javase-1.7.jar ,
qrgen-1.0.jar
and also added them to the build path.
However the import net.glxn.qrgen.QRCode from the QRGen library can not be resolved. Therefore I can't use methods such as QRCode.from("...") etc.
Does anyone have an idea why this import does not work?
Thanks in advance
v 1.2 is available through maven central.
see this comment: https://stackoverflow.com/a/16195951/439021
Related
I have got a code with following imports:
import com.thoughtworks.selenium.Selenium;
import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
I tried to use Maven to resolve, but I can't found these packages on https://mvnrepository.com. There are packages only under org.seleniumhq.selenium, but these aren't able to resolve method calls in code and there aren't any selenium named packages under com.thoughtworks.
It looks like those packages come from Selenium RC, from the times when it was created by ThoughtWorks.
See deprecated package list here, and migration guide here.
You probably want to migrate by disposing of the old dependency, re-writing the client code according to documentation, and use WebDriver.
In that case, your Maven groupID would be org.seleniumhq.selenium, as documented here.
I am quiet familiar with protobuf 2.5. I was trying to use protobuf3.0. It seems that the jar is to be generated form the source code available online. But when i import the source code into eclipse and try to create a jar, i can see many errors in the following files
/protobuf3/src/com/google/protobuf/Descriptors.java,
/protobuf3/src/com/google/protobuf/DynamicMessage.java
/protobuf3/src/com/google/protobuf/ExtensionRegistry.java
/protobuf3/src/com/google/protobuf/MessageReflection.java
/protobuf3/src/com/google/protobuf/TextFormat.java
/protobuf3/src/com/google/protobuf/UnsafeUtil.java
This is one of the errors "the import com.google.protobuf.DescriptorProtos cannot be resolved".
Is this the right way to generate the jar (or) is it available anywhere (or) is the full source code available anywhere.
Any help would be appreciated.
Thanks.
This is where i downloaded the source code protobuf3.0-source code
You can find a compiled (JAR) version of Protobuf to download here:
http://search.maven.org/remotecontent?filepath=com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar
I recommend you look at a build manager such as https://maven.apache.org/ to automatically handle fetching dependencies (libraries) for you.
I want import docs.actor.japi.FaultHandlingDocSample.WorkerApi.*; But I can't find the docs package which can use in maven central repository. And I don't find the information about docs package in the Akka official website.The akka version I used is 2.4.6.
If you are still seeing this error, remove the declarations for docs.* from the top of the example code. All of the values are present in the file itself. Re-import the declarations referencing the file and the errors should resolve.
So i am using gradle to get dependencies from maven central which is working fine. I just don't know how to import them to my actual java file.
How do i found out the name to import it?
at the top of my java file i have to write
import <name>
How do i find the name?
Thank You.
According to your comments. You have to import the packages, which are contained within the library, not the library itself. There is no guarantee, this package names are the same as group or artifact id of the library. To get know that package names, usually you may use a javadocs for the library. Or just simply let your IDE to make it for you, them you're trying to use some classes from that lib.
Alternatively, you can use some off-sites, like mvnrepository.com, where you may find your library and take a look at the packages list within it. For example, description for Apache Commons Lang library, where you can see the "Packages" section with all the packages within the lib. You may import them, just like:
import org.apache.commons.lang3.*;
One more solution, is to unzip a jar and take a look into it's content to determine the packages structure.
I am working through the RabbitMQ Java tutorial found here: https://www.rabbitmq.com/tutorials/tutorial-one-java.html
I have downloaded the Java Client Library package, and copied the JAR files to my project in Eclipse, but the import statements
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
all yield the error
The import "com.rabbitmq" cannot be resolved.
The instructions are unclear how to incorporate the JAR files from the Java Client Library package, how should I proceed?
You can download the rabbitmq-java-client-bin-3.5.4.zip from official link here . Then extract the rabbitmq-client.jar from the zip & add it to your class path in project. Then you will be able to resolve The import "com.rabbitmq". Give it a try.
Since the verified answer doesn't work anymore, here is my solution:
You can download the amqp-client-5.8.0.jar from here . Then add it to your class path, like any other jar.
In case that the link doesn't work, you can manually download it from here or even add the required dependency to your maven/gradle project.
For Visual studio code(vscode) we need to add the library file under Referenced Libraries enter image description here under the Java projects section.
enter image description here.imgur.com/txB2s.png