Solved

VM arguments in eclipse

Posted on 2014-03-06
1
1,169 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now