Gson Library not working in command line? [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 days ago.
Improve this question
Hello I am trying to run my maven project in the command line with the following dependency:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>provided</scope>
</dependency>
When I try to run the following line "String responseJson = new Gson().toJson(responseData);" it compiles with no problem on my Eclipse IDE. However when I try to start the same programm on the command line, the maven build works with no problems, however the programm just "stops" when it comes to the Gson line? I get no Exceptions and I can still do other things with the code but it just doesnt execute this line for some reason.
Things I tried:
I checked Eclipse java version is same as cmd java version.
I added .m2/repositories to the path variable.
Other maven projects without dependencies compile with no problem.
Can anyone help me or explain what reasons could be that everything is working in eclipse but not in the command line?

Related

Maven project that Sometime compile success but sometime compile failure [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
I have a project that setup with maven tool. So far, Sometime compile success but sometime compile failure. Each time failure informed difference errors that's why I didn't know root cause and I only execute command such as: mvn compile until it is successfully. Are there any opinions please sharing them with me. I thanks so much because this issue take a lot of time from me now.
Thanks
Try clearing the cache of your project or using mvn clean
you can try
mvn clean install -Dmaven.test.skip=true

How do I run java with command line arguments in VSCode? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
My employer has given me access to a site that teaches many things (not sure if allowed to post the name or not). I have decided to try and learn Java. The way this site teaches it is through IntelliJ, but I have learned JavaScript, Python, Node, and React in VSCode, and I don't want to learn another system.
Through Google, I downloaded JDK 11, as well as the Java Extension Pack. I have had a few errors that I have been able to resolve, but I am now stuck on java App.java. Earlier in the day, I was able to make it work, but now when I try to run javac App.java and then java com.example.App, it's not found. Nothing I have tried has made it work. Maybe it only worked before I used Maven...can't remember.
On the topic of com.example.App, is there an easy way to create a package? Google says it's almost always needed to create a package. Only way I've figured out how to do that is with Maven, but the quickstart version is 1.7 or 8 (when I have 11). So I have to go into the POM and edit
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
to
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
Is there a way to create a package without using Maven?
I just realized that I haven't even explained my title. So on the site I'm learning Java, it says there's a way to use command line arguments, for example:
java com.example.App "I am an argument"
Since I can no longer run my code with java, I can not do that. If anyone can help, you'd be amazing!
Q: Is there a way to create a package without using Maven?
I don’t see any direct relation between the two.
Packages are the logical grouping of classes in a folder structure in Java whereas Maven is just a Java build tool.
Yes, you can create packages without using Maven.
If you are using any IDE, for example VS Code you can always create packages as below:
Create a Maven based Java project. Maven projects have the following structure
src/main/java (all your source code goes here) and src/main/test (unit test goes here) , src/main/resources(non java files goes here).
Initially while creating the project you would have created a package with name com.example
To create a new package, right click and select New folder
Enter the folder name(this is your package name),for example "view".
Now you will have a new package com.example.vew. Similarly we can create packages at any folder level and place our Java file inside that.
Let me know if you this is good enough for you.

How to run unit tests only for a class in a Hybris project through Command line? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
Many times due to some errors in project or mis-configuration in eclipse, Junits fails to run for a class. How one can execute such unittests from command line without wasting effort.
Many times due to some errors in project or mis-configuration in eclipse, Junits fails to run for a class. While working in a hybris project, we have an option to execute our junits from command line as well.
Go to platform directory.
Set ant environment.
Execute test with below script:
ant unittests -Dtestclasses.suppress.junit.tenant=true -Dtest="**fully-qualified test class name**"
or
ant unittests -Dtestclasses.suppress.junit.tenant=true -Dtest="de.hybris.platform.acceleratorfacades.cart.action.populator.AcceleratorCartEntryActionPopulatorTest"
Then one can check report generated at below directory.
Report dir : D:\HybrisSetup\Code\hybris\log/junit

Importing Quandl library into Android [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am currently 3 months+ into programming and am trying to build an android app that takes data from Quandl.
How do I import the Quandl library into my Android project? I have tried to search for answers - they typically tell me to add the .jar file, but there is no .jar file in the Quandl library here (taken from the link below).
https://github.com/jimmoores/quandl4j
Will really appreciate it if someone posts a step by step guide for a noob beginner like me.
The answer is in the link you have provided:
https://github.com/jimmoores/quandl4j.
Look at Quick Start section. You have four options.
You can download zip. There is source code inside. You should unzip this archive and then use maven to build jar file. Go to main directory, where pom.xml file is and execute mvn install. If build is successful then jar file should be in target directory.
If you are familiar with git you can clone repository and as previous crate jar with maven (mvn install).
You can use maven to add dependency to your project automatically.
You can use gradle, another tool that automates process of building dependency.
Generally speaking: you are new to programming, spend some time learning about maven, because this tool will help you a lot in your career.
https://maven.apache.org/
After reading this answer please remove this question, because it has a little value for community.

Cannot resolve R android studio 1.2.1.1 [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have just created an android project in android studio 1.2.1.1 but it says cannot resolve R. I have not changed the manifest or the xml which are usually responsible for that problem.
I'll post the answer for anyone finding it useful, in the end i just had to update the sdk manager to 22.0.1 and change the gradle build tools version to the latest meaning the one i downloaded
Try to build or clean project. It always occurs after create new project because R is generating at build process not while creating project.
Its also happens when you dont have necessary support files..
Check the error log, it should be showing some kind of error that will help you to resolve the problem..
Check if yours xmls are ok,you can have bugs there.
Also try clean the project or build it again.Other solution can be change something in your code and build.
R.java is a file that regenerate, so you can close Android Studio, delete R.java and open it again.

Categories