I'm looking for some way to switch between default VM arguments. I've got a workspace with a bunch of projects and created run configurations for running JUnit tests. I'm able to switch between run configurations easily.
In order to run any test correctly, I need to pass some arguments to JVM. This is problem whenever I want to run a specific test method SHIFT+ALT+X,T. Since it creates a whole new Run Configuration, it doesn't pass any VM arguments to it.
I figured out how to set default VM arguments using Window -> Preferences -> Java -> Installed JREs -> Edit -> Default VM arguments. This, however, means that whenever I need to switch to different VM arguments, I'd have to do it manually.
What I'd need in the most optimal case is some select box visible on the toolbar, where I could switch between global run configurations from which all newly created ones would "inherit".
I'd also like to see a way to make automatically created run configurations destroy themselves as soon as I switch to a different one, because at this point, I have 36 run configurations (which I manually created) and I don't want to see a "garbage" from each test method I executed. Over the time, there might be thousands of Run Configurations in between which I'd have to search. I don't want to spent few minutes a day deleting them.
So, the recapitulation:
Is there a way to easily switch between default VM arguments?
Is it possible to keep the list of Run Configurations clear, meaning it will only contain run configurations I created?
Related
Wasnt able to solve the problems in this screen.
http://s8.postimage.org/n5osf76ed/qestions.jpg
All the code worked a month ago.
What have I changed: I have a different version of eclipse (now: Eclipse IDE for Java Developers 1.5.1.20120920-0737, don't know what the previous one was).
Messed with environment variable. Since this does not effect the ot
Please help.
Try this solution mentioned in this discussion.
I just ran into this problem using standard (not Stanford) Eclipse.
By now this is probably moot for you, but I'll post my solution for
future travelers.
The launch configurations for Assignment 1 default to Applet, so the
containing Karel application isn't launched. To solve this, create
and use new Application launch configurations for each file.
If you already tried to run some of the files, delete the Applet
configs created so you can reuse the names:
Open the project properties (e.g. right click on Assignment 1 and select Properties).
Select Run/Debug Configurations.
Select and Delete each configuration.
Click OK.
May the Force be with you.
Create Application configs:
Right click on java file (e.g. CollectNewspaperKarel.java) and select Run As > Run Configurations...
Select Java Application in the left pane.
Click New Launch Configuration (the icon of a document with a +).
Type a name for the configuration and set its Main class to the associated file (e.g. CollectNewspaperKarel).
Click Apply then Run. (This should run correctly and create a useful entry in the Run History.)
Eclipse will still try to default to Applet, so you will henceforth
need to launch these configurations from the Run History (either from
the Run menu or the pull down on the run button). If you accidentally
launch as default, it will add a useless Applet configuration to the
Run History (e.g. CollectNewspaperKarel (1) ). You can delete this
from the Run Configurations dialog to keep the Run History tidy.
The eclipse used in CS106A is customized for stanford and for "karel the robot" :)
Just download and install it again and things should work just fine.
Looking at LWJGL installation here.
I'm having to change the VM Options line (under Project Properties->Run) to run under Mac, even though I am continuing to develop in parallel on Windows.
That's really tedious, as I don't want to have to be changing the path each time I switch -- which will be all the time.
Any ideas on how I might get around this?
You could create two sets of configuration: In Project Properties > Run > New Configuration.
Create 2 configs (say "Win" and "Mac") with the respective VM Options.
You can then switch from one to the other with a right click on Project > Set Configuration > Win / Mac.
I have a main class that takes a series of arguments and I have 10 run configurations. Is there a way to have eclipse run them one after another?
The other answers are probably better solutions to your problem. However, if you install the Eclipse CDT into your Eclipse installation (using update manager or market place client), then you get an additional launch configuration type called Launch group.
Those launch groups allow creating a list of other launch configurations to be run one after the other. Make sure to set the Post build action in the dialog to "Wait until terminates" for each included launch configuration.
#Steven: To do it quick, you can write a JUnit Test case that just calls the intended classes in desired order and execute it. Eclipse already has the necessary jar for JUnit, so you are ready to go. Definitely, writing ANT/MAVEN script is a good practice.
As #gotuskar suggested, write test cases for your class. If you can afford running your ten configurations each time you build your project put them in its src/test/java directory, otherwise create a sibling project to your original one, make it depend on it, and put your tests there.
I have lot of junits that depend upon the same jvm system props. Currently, I need to add these specifically for each of the junit's. The best I could do was to create a new VARIABLE and then reuse the variable across all these tests. Still, I need to specify this VARIABLE explicitly for each of the tests. Is there any way I can specify this at the eclipse level?
Under Preferences -> Java -> Installed JREs. You can edit the JRE installation and set default VM arguments.
I need to pass a VM parameter to every test that is run in the project. Setting this manually doesn't seem to be the most convenient solution, so is there any possibility to pass the parameter to every test automatically.
Thank you for help.
We change the JRE Configuration in Eclipse (Preferences>Java>Installed JREs). There you can set default VM Arguments which are used for anything you run with that JRE.
Now simply configure your project to use this JRE (Java Build Path) and you should be on the right way.
Eclipse have already a built-in JUnit for you.
You can use JUnit to run different parameters on your main program.
Run your test once, this creates a run configuration.
Run-> Run Configurations -> JUnit, select your run configuration, then you have an arguments tab to specify JVM or program arguments.
You can then duplicate this run configuration to use for other tests. I'm not aware of any way to make a default setting to be applied to all future test launches.
I think you are using "Program Argument" instead of "VM argument" now. If you use VM argument it's mean globally applied to all of your tests.