I downloaded breeze jar files from the link, then I went to Project Structure->Modules->Dependencies and added downloaded jar files.
I made a new project->Scala class and wrote the following code:
import breeze.linalg_
object Scrpting extends App{
println("hello")
}
I get the following error.
Error:(4, 8) not found: object breeze
import breeze.linalg_
I tried to search online, but was unable to find any clear useful resource on how to use breeze with IntelliJ. Can someone please help me with this? I am using Mac OS.
In your build.sbt file, make sure you add all the dependencies listed under "libraryDependencies" at
https://github.com/scalanlp/breeze
Related
So I am trying to import this class from my jar file. IntelliJ recognizes access to all the folder structures but not the class.
Says: "Cannot resolve symbol 'Constants'.
Note that I have tried clicking "Add library 'premiumdue.main.jar' to classpath" and it still doesn't work.
I have no idea why it won't let me import the class.
Here is a minimal intellij project showing my issue: https://www.dropbox.com/s/xzvv2x1ca2lld26/jar_issues.zip?dl=0
For your sample Gradle project, the dependency jar has to be referenced in build.gradle file as described in this answer.
dependencies {
implementation files('../create_jar.jar')
}
Proof:
This question already has an answer here:
Eclipse Java IDE JUnit5: junit.jupiter.api.Assertions is not accessible
(1 answer)
Closed 2 years ago.
I am new to Java and Project Lombok, I am trying to follow some tutorials to understand it better. I have created a very simple java project to test the Project Lombok and it throws the error Data cannot be resolved to a type when I add the annotation #Data to my class.
I am using macOS and Eclipse IDE for running my Java application. Following are the steps that I followed to run my first Java and Lombok project:
Downloaded the latest Project Lombok version 1.18.16 and placed it in the Documents folder.
Installed the Project Lombok in my system using the command java -jar lombok.jar.
Restarted my Eclipse and verified that Project Lombok installed in the Eclipse -> About Eclipse: "Lombok v1.18.16 "Envious Ferret" is installed. https://projectlombok.org/"
Created a new Java project and the class Alien.
Added the Project Lombok JAR to my project Classpath.
Added the #Data annotation to my Alien class and imported the JAR file but I get the error The type lombok.Data is not accessible for my import statement import lombok.Data;
Also, I get the error Data cannot be resolved to a type for my annotation at the class level public #Data class Alien
I am really unsure what's wrong. I tried to find out but all the answers have mentioned the same steps. I was just wondering what am doing wrong. Any help would be really appreciated.
Following is my complete code:
package com.lamboktest;
import lombok.Data;
public #Data class Alien {
private int age;
private String name;
}
The error The type SOMETYPE is not accessible is... bizarre. As far as I know, there are only three ways to get that error:
lombok.Data isn't public. Except, it is, so this can't be it.
You've manually added a list of forbidden packages ('access rules') in eclipse, to deny yourself access to lombok. Presumably, you'd remember if you did that, so it can't be this.
lombok is loaded as a module, and the lombok package isn't exported. Except, the only versions of lombok that exist either aren't modularized (and module-info-less jar files export everything), or they are, and the lombok package is exported. So it can't be this.
Perhaps it would be useful to doublecheck all of these:
I guess javap -cp lombok.jar lombok.Data, and check that it's public, but, this just cannot be it, so you probably don't need to bother.
For that access rules thing, which is the most likely of 3 very unlikely options, go into your project's setup (right click on it in e.g. the package explorer, and pick 'properties...', you can set up lots of stuff from there), go to 'build path', find the lombok.jar, open it up, and check 'access rules'. It should read 'no rules defined'.
Go into your project's setup and ensure it's all set to java8, and rebuild. Presumably you want to use new features, but the point is to at least isolate down to: It's a module issue.
Posting the answer as it maybe useful for somebody in the future.
As mentioned in the comment removed/deleted the file module-info.java which was created by default during the project creation. Everything worked as expected.
I have found many tutorials, which showed me how to connect with websites and fit some forms, but almost all of them contained small piece of code - without imports, I figured out that i need to use special library like htmlUnit or Watij, so I downloaded it, and tried to use but i couldn't. I have tried putting all jar files from downloaded zip archive to lib folder in java compile but it didnt work. I have also try to compile with
-classpath - but it didn't work - probably I used it in wrong way, all time i m getting .
Main.java:5: error: package [...] does not exist.
How can I add library to java compiler or how can I compile file with library properly.
I m using windows and jdk version: 10.0.1, also i m not using any advanced java editor like eclipse.
So in conslusion:
import gargoylesoftware.htmlunit.WebClient;
import gargoylesoftware.htmlunit.html.HtmlElement;
import gargoylesoftware.htmlunit.html.HtmlOption;
import gargoylesoftware.htmlunit.html.HtmlPage;
import gargoylesoftware.htmlunit.html.HtmlSelect;
final WebClient webClient = new WebClient();
final HtmlPage page1 = webClient.getPage("http://some_url");
I have got something like this in my code and i m trying to compile it (after putting jar files from zip(https://sourceforge.net/projects/htmlunit/) in lib folder (located in jdk folder)) with this command:
javac Main.java
and this(where zipo.zip is downloaded archive from upper link):
javac -classpath watij.jar Downloading.java
but for every import it ended in this compilation error:
Main.java:6: error: package gargoylesoftware.htmlunit.html does not exis
Thanks
I know that it was hard to understand my problem.
I managed to find a solution while trying to paraphrase the problem.
The thing, which i was doing in wrong way is exactly the same as in article below.
How to compile Java program with .jar library
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 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