My goal is to be able to use the following -> OkHttpClient client = new OkHttpClient();
However Intellji still isn't recognizing it.
I have tried the following ->
1: Gone to
https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
and downloaded the latest version of the far file okhttp-5.0.0-alpha.11.jar
2: opened Intellij and sourced the file in the modules section.
Please help, I don't know what i am doing wrong?
error screen shot
jar file add
I want to be able to make http requests so that i can use api's.
you need to import the package:
import com.squareup.ok http.OkHttpClient;
Related
I'am using NetBeans to write a java application that would allow me to get the zip file of a GitHub user repository. In order to do that, I imported an external jar library, jcabi library, into the netbeans project that let me communicate with the GitHub API.
How I imported: right-click on the project -> properties -> libraries -> Add JAR/Folder
Then I start coding: I tried different constructors for the Github class (the root for communicating with the whole library), but always the same error.
I also tried with another .jar library: kohsuke -> same error.
And if it is not enought, I also tried with eclipse -> same error.
Now, I don't know what the problem could be:
Library importation? (When I write The Github class, netbeans shows me the possibility to import the class, so I don't think this could be the problem, but still...)
My usage of the Github constructor (Probably)
something else?
First make sure you download this jar file: jcabi-github-0.23-jar-with-dependencies.jar. It has all the dependencies you need. Which can be found here towards the end of the page.
It is strongly recommended to use RetryWire to avoid accidental I/O exceptions:
This compiled for me:
Github github = new RtGithub(
new RtGithub()
.entry()
.through(RetryWire.class)
);
Sample program:
Github github = new RtGithub(
new RtGithub("yourUsername", "yourPassword")
.entry()
.through(RetryWire.class)
);
Repo repo = github.repos().get(
new Coordinates.Simple("sebenalern/database_project"));
Issues issues = repo.issues();
Issue issue = issues.create("issue title", "issue body");
issue.comments().post("issue comment");
After running the above code it posted an issue in my repo with title as "issue title" the body as "issue body" and a comment as "issue comment"
Hope this helps! Let me know if you need anything clarified or more examples.
Note this code was tested.
My current setup :
OS : windows 7
IDE : Android Studio (with updated SDKs)
Parse jar (v 1.10)
I am trying out an example for ParseQueryAdapter, and I run into this error on my IDE : import com.parse.ParseQueryAdapter; -> cannot resolve symbol ParseQueryAdapter
I want to try something similar to this example, and the import does not seem to go through because of the error.
If you need anymore information, please leave comments & I will respond.
PS : I am able to add com.parse.ParseObject without errors.
In your libs folder you'll find Parse-1.4.1.jar file.
Right click or control+click on it then 'Add as Library...'
Edit: Parse-1.10 does not have ParseQueryAdapter. You have to use Parse-1.4.1, which is included in that example.
ParseQueryAdapter was removed from the official Parse SDK and moved onto the Parse-UI libraries..
You can install them on via this link: https://github.com/ParsePlatform/ParseUI-Android
If we include 1.4.1, and keep 1.10.1 as well, it gives error because we cannot keep the same jar with two versions in the libs folder. And I think its not advisable to use just 1.4.1. I feel that ParseQueryAdapter is deprecated and we would just have to use the normal adapters. Any comments?
I am working with android studio attempting to implement the following github within my own application
https://github.com/jhansireddy/AndroidScannerDemo
When following the instructions I add the following line to the gradle
compile project(':scanlibrary')
After adding the above i then sync the gradle and the whole project structure changes, to the point where i no longer recognise it
Original Project Structure
New Project Structure
If you havnt gathered i am fairly new to the whole android programming thing
One thought i had was that the git project uses OpenCV and it was related to this, however i have not manually installed OpenCV
You have to import scan library to bring project structure to normal. Follow these steps:
1 - Download zip from this link.
2 - Extract it and copy location of scanlibrary project present inside ScanDemoExample. In my case it is like (D:\Amrit\AndroidScannerDemo-master\AndroidScannerDemo-master\ScanDemoExample\scanlibrary).
3 - Now come back to Android Studio, select
File -> New -> Import Module
and paste copied location path from previous step in source directory which will result in module name :scanlibrary. Click on Finish to close the dialog.
4 - Now your project structure will look like image below. (You can view it by selecting File -> Project Structure).
5 - Don't forget to add dependency
compile project(':scanlibrary')
inside build.gradle file.
6 - Now your library is ready to use with your project. In case you are facing any errors try cleaning & rebuilding your project. And more often errors are import problem so try including these imports :
import com.scanlibrary.ScanActivity;
import com.scanlibrary.ScanConstants;
where ScanActivity & ScanConstants are classes present inside scanlibrary.
Let me know if you have any doubts. Happy coding!
add this depenedency in build.gradle
implementation 'com.github.neutrinosplatform:scanlibrary:3.3'
and add maven in repositories
maven { url 'https://jitpack.io' }
I have a HelloWorld Java app called FitnessTracker that I want to clone as another name, FDE3, leaving the original website in tact. I performed the following steps an attempt to do this. Please tell me where I went wrong and/or what else I need to do.
Change Context Root
Confirm Change Context Root
Still the original "FitnessTracker" name persists and I'm not sure how to get rid of it.
If I was able to successfully clone the FitnessTracker webapp as FDE3, I should be able to access the new site as
http://localhost:8080/FDE3
But I get an invalid resource error. Instead, the site is still accessible as
http://localhost:8080/FitnessTracker
..because of reminants of the old name.
What do I need to change within Spring Tool Suite to get the web app to use only the new name? To minimize chance of corruptying the project, I'd rather do it via the STS GUI over manual modification of any system file.
I see that the following file contains the text "FitnessTracker" but I would rather not modify it manully for fear of breaking. What GUI option controls this?
Search "fitnesstracker" (2 hits in 1 file)
C:\Dev\Workspace\FDE3\.settings\org.eclipse.wst.common.component (2 hits)
Line 2: <wb-module deploy-name="FitnessTracker">
Line 7: <property name="java-output-path" value="/FitnessTracker/target/classes"/>
Sorry for being a noob.
Update:
I'm not sure what I did, maybe just clean, refresh, open/close a million time, dunno, but now when I run the web server from with the Spring IDE the site is coming up using the FDE3 path, however, I am wondering why I see a reference to Fitness in Parens in the project node.
Earlier, it just displayed "FitnessTracker" in parens, now I see a full path to a Test folder...
Update 2:
When I copied the FitnessTracker project as FDE3, I didn't expect that the new FDE3 project would have any ties to FitnessTracker project and I didn't think that the new FD3 project would be in SVN until I added it to SVN, but based on the icons I see below, it looks like it is, (I'm new to SVN, too)
It looks like my issues are related to SVN.
Why is there a tie to the original FT project and why? How should I have clone the FitnessTracker project?
Yes, your issue is indeed related to SVN. Copying an SVN working copy will copy .svn folders inside that and will be pointing to the same URL in the SVN repository. What you have to do is an SVN Export of your FitnessTracker project to FitnessTracke-Ex first in either Tortoise or Subclipse SVN client and then import that project into your STS Eclipse environment. Finally you can copy and rename the FitnessTracke-Ex project FDE2 or FDE3
See this
post on how to Export a working copy
See this post on how to Import an existing project into Eclipse
I'm trying to generate some stubs for a WSDL (using xmlbeans) and keep running into some issues. I'm using the following page:
http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients-xmlbeans.html
The only part of these steps that I'm skipping is the "client.java" part because I already have another project ready I want to plug the resulting jars into. A quick run down of my steps are as follows:
My WSDL is a crmonline instance, so I run something like this:
C:\Work\aaa2>WSDL2Java -uri
https://mycrmorgname.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl
-p crmsdk -d xmlbeans -s -o c:\mystubfolder
I build the project using "ant"
In my "client" project I reference the 2 jars created in .\build\lib
My project builds fine once I add all my axis2 / apache references etc, but when I launch it through playframework I get errors when I hit the first page. The first error seems to be:
17:48:45,289 ERROR ~ Error in ControllersEnhancer.
controllers.ProfileController.editProfile has not been properly enhanced
(fieldAccess javassist.expr.FieldAccess#212ca458).
or something similar to that. Scrolling down through the error I can see that I'm getting this:
The file /app/models/MyDynamicsClient.java could not be compiled.
Error raised is : org.apache.axiom.om.util.AXIOMUtil cannot be resolved
Now, I haven't even hit any of my web services yet, or even instantiated any of my classes ... I'm at a loss as to why this is happening. Or to be more accurate, what exactly am I messing up! Am I missing a reference to something? Doing a search on AXIOMUtil tells me this should be in Axiom-api (version I have is Axiom-api-1.2.10.jar). I have this referenced and doesn't seem to help. Or maybe I'm doing something else wrong someplace?
Some details on versions:
Axis2 1.5.4
Apache-ant 1.8.3
Any help would be very much appreciated!!
Ok, after trying a lot of different things and rereading the sites/instructions I realised what I was doing wrong. Or at least I figured out a couple of things that I started to do differently that fixed the problem.
Firstly, I was using jar files from another sample project for the apache http components. I don't know if this had an impact, but I downloaded a fresh version of this anyway and referenced those JARS instead.
Also, instead of creating jars in my "stub" project and referencing those I copied all the generated stubs/classes directly into the existing client project. I have a feeling this might have been what fixed my problem. Or maybe a mix of this and the previous step I did!
So my new steps are as follows:
Ensure you have all the correct versions downloaded for required components. In my case I have the following:
Apache Axis 2 v 1.5.4
Apache HTTP components client 4.1.3
Apache-ant 1.8.3
Copy all the JARS from the Axis2 and HTTP Components libs into your client project and reference them.
Use WSDL2Java to create your stubs and classes within it's own project.
Ensure the project builds using Ant
Copy all the generated class files within the src folder into the source folder of your client.
Fix any other reference isssues and Build
Thankfully this got me going.