Need help understanding how to use a maven artifact in my code - java

I'm trying to do exactly the same thing as described in this stackoverflow question:
Simplest way to read JSON from a URL in Java
For the top response, I understand the code, however, they say "Using the Maven artifact org.json:json I got the following code". Now, I'm completely new to Maven and I have no idea how it works, although I do have it installed.
I've tried searching the internet on how to use this Maven artifact in my code but I can't find anything and I am completely lost.
If someone could point me in the right direction or help me out with this that would be greatly appreciated!

Related

I'm trying to use MediaTypeUtils.getMediaTypeForFileName

sorry to bother you all but I have a simple issue which is obsessing me, I'm trying to use MediaTypeUtils.getMediaTypeForFileName but I can't manage to find any dependency, I only get "cannot be resolved" for a project trying to get a .zip file on a external API. I don't think the rest of the code matters a lot since it's definitely not working yet.
Please give me any tip or advice as I'm quite the beginner. Thanks a lot.
Okay I found out that it was just an import from another java file that I didn't notice on the project, that's why I couldn't find any dependancy. I had trouble with it because it was some random tutorial on the web and it wasn't much documented.
Sorry about that.

The package is accessible from more than one module (Error fix for using SAX in Eclipse)

There are a lot of questions out there with this problem but i haven't found a solution for using SAX with this problem, so I found a simple workaround for me I wanted to share as a own answer.
In my case I imported this class and got the famous error you will know about if you have it to. :D
import org.xml.sax.SAXException;
I tried the solutions from the other questions with similar titels, but without a working solution.
Look at the answers to see what I did. If you have a better solution please send other answers to this question :)
To understand the problem:
This error will happen if Java can't unique identify your class.
I know that this is a problem with newer Java versions and modules so I tried to find out if I have a module with this class, because SAX is included in the JRE.
All you need to do is to remove the java.xml Module, what you can do in Eclipse if you open the Build Path and go to Module Dependencies.
Just click to the remove button when you selected it, to remove the module.
That's it, simple right? The only problem is when you need other Classes that require this module, than you need to find a better solution.

Cucumber: IDEA: No features found at "path" error

I've got a problem.
When i'm trying to run my runner with tests, i've got error that "No features found". I'm trying to use "feature" parameter and without it. But still always got that error. Please someone helpt me. See screenshots with "features" without "features"
I've found the solution. You need to give your feature files extension ".feature". And better rename your "Runner" to "RunnerTest". It's helped me. Good luck everyone!

How to propperly publish an Android library?

I made a library for reading and displaying csv files in the simplest way I could find, and it works great on my application, but once I try to publish it, on maven or jcenter, they accept what i did and show me a message telling me that everything is fine, but I can't use it with the gradle import in any way. I might be doing something wrong and I can't figure out in which step. Can someone please post here a updated step-by-step tutorial on how to publish libraries? Thanks!

Sphinx4 Beta API Problems With Eclipse

I'm trying to set up a simple helloworld demo with Sphinx 4.0 (which is apparently a beta?) I downloaded the source and added it as source to Eclipse, but the problem is, it doesn't recognize a lot of the classes. I've been looking, and as far as I can tell, the classes it wants just aren't there! For example, the line:
import javax.speech.Central;
throws a compiler error, saying something about how the import couldn't be resolved. Is this a part of a bigger API I was supposed to download before trying to do Sphinx4? It didn't say anything about any other API but I'm open to the possibility.
If you want, I can post a list of all the imports that can't be resolved, I will, but that means looking through all the code which is kind of a pain. I have a hunch that I need to download the JSAPI, but I don't know which implementation would be good for Sphinx4.
Links to Sphinx4 downloads:
http://sourceforge.net/projects/cmusphinx/files/sphinx4/1.0%20beta6/
http://cmusphinx.sourceforge.net/
EDIT: In addition, I've found a few lines that I think might mean I need to download JUnit? Again, I'm not totally sure how to set this up.
The great thing about this site is that the simple act of typing out a question and nervously analyzing it before finalizing any revisions (because, after all, someone WILL read this!) 95% of the time I answer my own question within 5 minutes of posting it.
Anyways, the solution was simple, I downloaded junit4-10.jar and jsapi.jar and added them to my Java build path. Then, I got more errors, and I said TO HECK with building from the source (which I was doing with sphinx4 here) and I just downloaded the already-built library and it works great. Got the HelloWorld I wanted!

Categories

Resources