Solved

VM arguments in eclipse

Posted on 2014-03-06
1
1,421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 36

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

617 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