I'm trying to follow "How to run a compute-intensive task in Java" tutorial.
However, I'm stuck on the following step:
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-classic-java-run-compute-intensive-task/#how-to-create-a-java-application-that-performs-a-compute-intensive-task
Eclipse shows an error saying that these dependencies can't be resolved:
import com.microsoft.windowsazure.services.core.Configuration;
import com.microsoft.windowsazure.services.core.ServiceException;
import com.microsoft.windowsazure.services.serviceBus.*;
import com.microsoft.windowsazure.services.serviceBus.models.*;`
I'm using Eclipse and I've downloaded the Azure toolkit for Eclipse.
Here's how my Eclipse project looks like:
The code is simply a copy-paste of TSPSolver.java.
Per my experience, the issue was caused by missing some dependent libraries that you can try to add them via configure the Java Build Path or configure the pom.xml file in the Maven project to resolve it.
For the first way, adding the dependent libraries via configure the Build Path. You can download these libraries and their dependencies from the link.
Right click on the project name, then select Build Path and click Configure Build Path.
Add these jar files via click Add External Class Folder
For the second way, adding the maven dependencies in the pom.xml file.
Convert the current normal Eclipse Project into a Maven project.
Open the pom.xml file in the project and add the below content from link1 & link2.
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-core</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>0.9.7</version>
</dependency>
</dependencies>
For those looking now, latest version are as follows:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>3.6.7</version>
</dependency>
Related
I am trying to implement Google's calendar API into my spring boot project in eclipse. I am following this Java tutorial from the Google Developers' website
I am on step 3 where I am to copy in code, however there are errors under all of the Google API imports:
The error I get:
The import com.google cannot be resolved
The Gradle file leading to the error:
UPDATE:
I added the following to the Pom file and it removed almost all of the import errors:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-calendar</artifactId>
<version>v3-rev224-1.22.0</version>
</dependency>
However, the following two imports still have errors:
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
You cannot use both gradle and maven together. Use either gradle or pom.
Remove the gradle build file and add the dependencies in the pom.xml as you mentioned.
Then go to maven ==> Update Project
And that should download the dependencies and fix the errors.
You have to add all the dependencies to the POM file:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-calendar</artifactId>
<version>v3-rev305-1.23.0</version>
</dependency>
I think issue here is the way eclipse handle gradle project
Use Eclipse Version: Oxygen Release (4.7.0)
install https://marketplace.eclipse.org/content/egradle-ide#group-details
re import your project as gradle project
==
delete pom.xml, I think eclipse confuses between gradle project vs maven project
I am trying to build my maven project in IntelliJ.
I added the dependency in the pom file as shown.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/sqljdbc4-2.0.jar</systemPath>
</dependency>
I also have the sqljdbc4-2.0.jar in the /lib folder.
I am able to successfully clean the project and package it. However, when i run the jar on my linux machine it gives me following exception:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
Please help. Struggling with this for quite some time. Thanks.
I am nor able to run my eclipse maven project. I keep getting the following error in the problems tab
Archive for required library: 'C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar' in project 'Inspirations' cannot be read or is not a valid ZIP file
In my pom.xml file I have defined the dependency as
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
You can try delete mysql folder in your repository and go to eclipse -> Maven --> Update Project.
If not working, i thinh u can try another version.
I created a small java application using intellij, later I updated that project as Maven project using "Add framework support" option. When I tired to add spring jar file on project I got following error saying,"No files were downloaded for org.springframework:org.springframework.core:3.2.2.RELEASE".
Following are the steps I did to add spring jar files
1)Clicked on File -> Project Structure -> Modules -> Clicked on "+" Sign -> Library -> From Maven
2)Searched for org.springframework.core and selected 3.2.2 Release
3)Downloaded to lib folder under my project.
4)Got Error.
I don't know where it went wrong. I am new to java and spring application.
As already mentioned, Maven downloads dependencies itself (a reason why it's a build automation tool).
To add Spring as a dependency, add this code to Maven's pom.xml (the file is in your module's root directory):
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.2.RELEASE</version>
</dependency>
</dependencies>
Also, delete the lib directory from your project root - Maven doesn't put jars there.
Maven downloads the dependencies automatically, can you try adding this to the pom.xml file. Maven should automatically download the dependencies..
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.2.RELEASE</version>
</dependency>
My maven project uses Directory API Client Library for Java and i needed to include it as a dependency. But in Directory API Client Library for Java page, under the Add Library to Your Project title when i select maven as my build environment it always showed,
"Add the following to your pom.xml file:
This library is in the process of uploading to the central Maven repository. Please check back in a few hours."
for last couple of weeks.
Since i have used google drive dependency in another project as follows,
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev60-1.13.2-beta</version>
</dependency>
I tried to so the same by including,
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-directory</artifactId>
<version>v1-rev28-1.17.0-rc</version>
</dependency>
but it didn't worked.
And for the recode my pom having following repository as well,
<repository>
<id>google-api-services</id>
<url>http://google-api-client-libraries.appspot.com/mavenrepo</url>
</repository>
What is the correct maven dependency to use Directory API Client Library for Java.
At the bottom of the page, there is a link as follows,
See all versions available on the Maven Central Repository.
I have went through that page and found a previous version of Directory API Client Library for Java. By looking at it's pom i have tried following dependency and it worked.
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-admin</artifactId>
<version>directory_v1-rev22-1.16.0-rc</version>
</dependency>
Then I tried to update the version to latest as follows and also worked.
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-admin</artifactId>
<version>directory_v1-rev28-1.17.0-rc</version>
</dependency>