0

I'm pretty new to Java, the only other language I know is python. My OS: Windows 8.1, Java: jdk 9.

In python you could install packages using pip. How is this done in Java? I've googled around and the closest thing I found is Maven Apache.

But I can't find any clear instructions on how to install a java package using Maven. I tried "mvn install gson-2.8.2.jar" with the gson-2.8.2.pom file in the same folder, using powershell. But all I get is this Build failure error:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Program Files\Java\jdk-9.0.4\lib). Please verify you invo ked Maven from the correct directory. -> [Help 1]

I'm trying to install the gson package. Any tips on how to do this would be appreciated!

AltoBalto
  • 371
  • 1
  • 7
  • 14
  • Maven is not quite like other package managers that you may be used to (pip, npm, rubygem, etc.). You should probably read a quick start guide for maven. There are tons of them out there. – rmlan Feb 08 '18 at 13:53
  • Note the part where it says "The initial learning curve is steep". If you want to start doing actual programming it might be better to forget maven for now. You might want to check out [Gradle](https://gradle.org/) too. It's a newer participant in the build tool gang. – Kayaman Feb 08 '18 at 13:54
  • @Kayaman I just need a simple way of installing a package I need in order to get started programming. How can it be so difficult to install packages for a popular language such as Java? Is there someway to do it completely wihthout maven and such? – AltoBalto Feb 08 '18 at 14:15
  • @rmlan I read the quick start guide, didn't make sense. Guess because I Was thinking in terms of pip. I can give it another try. – AltoBalto Feb 08 '18 at 14:15
  • Maven is difficult and you're thinking about "installing packages" which is nonsense in the Java world. I'd suggest following a good tutorial instead of trying to mimic things you've learned in Python. You don't start speaking French by saying "well this is how it's said in English, so I guess it's the same way then". You'll have to learn about things like the classpath etc., so don't expect to get anything working quickly and/or simply. I'd probably stick to Python if I were you. – Kayaman Feb 08 '18 at 14:19
  • @Kayaman Thanks for the encouragement to keep learning java! I don't expect things to be easy or work quickly :) As said, I'm new to java, but also to programming alltogether. Doing what I need to do in pyhton was so easy, I expected it to be the same for java. Now I find out it's not and that's okay. I'm trying to look for good tutorials, but it's been hard to find concrete info on a beginner level regarding this subject. I will keep looking, but I would appreciate links to any such tutorials. – AltoBalto Feb 08 '18 at 14:27
  • I recommend looking straight in the horse's mouth: https://docs.oracle.com/javase/tutorial/ – Kayaman Feb 08 '18 at 14:35

0 Answers0