Solved

VM arguments in eclipse

Posted on 2014-03-06
1
1,224 Views
Last Modified: 2014-03-25
Hi,

My test1JUnit.java has below entry


       final String testFileName = System.getProperty("project.basedir") + "\\src\\main\\resources\\temp\\test.txt";


In order for me make junit to work i have to go to junit run configuration --->arguments--->VM arguments the add

-Dproject.basedir=C:\\TestPOC\\current\\TestPOC


Then it all worked.

test1JUnit.java has is calling TestService.java which also has entry

       final String testFileName = System.getProperty("project.basedir") + "\\src\\main\\resources\\temp\\test.txt";


so fixing below took care inside TestService.java also.
"i have to go to junit run configuration --->arguments--->VM arguments the add

-Dproject.basedir=C:\\TestPOC\\current\\TestPOC"



My question is

"i have to go to junit run configuration --->arguments--->VM arguments the add

-Dproject.basedir=C:\\TestPOC\\current\\TestPOC"

Doing above step is not only fixed for junit test class but also TestService class also?

What is meaning of the VM argument how it fixed in both places?


please advise
Any links resources ideas highly appreciated. Thanks in advance
CAn we send different environment property files(dev, qa, prod) using the arguments for maven build?
0
Comment
Question by:gudii9
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39911391
It fixed for both because as you said, test1JUint.java is calling TestService.java, and so therefore the code in both are running in the same JVM. And system properties are defined across the entire JVM and so that property can be accessed from both location that you are asking about.

Generally speaking, to support different environments (such as dev, qa, and prod) you can use a feature of Maven known as Profiles. Firstly have a read of this...

http://maven.apache.org/guides/introduction/introduction-to-profiles.html

... and if this looks like what you are after, I can help/guide you further.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error trying to install RTMT Win7 5 60
Apps blocked by Java 9 79
even odd program using while loop 3 40
How to determine if a string is a valid SHA value 7 29
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question