Community
Participate
Working Groups
20071127 - create a project with JUnit 3.8.1 code (from the smoke test) - create a Java application launch configuration for 'junit.textui.TestRunner' add 'junit.samples.VectorTest' as program argument on the second tab page - create a runnable JAR from this launch configuration - run the created JAR The command says that arguments must be specified. It seems that the program arguments 'junit.samples.VectorTest' are not used.
We should fix this, its a new feature. Ferenc? Is this possible? Can the manifest contain main class arguments? Can you have a look at this until end of next week?
The requested feature is not supported by standard jars. There is no Attribute in the manifest to specify the application args. The arguments have to be entered in the command line: java -jar xxx.jar [app_arg1] [app_arg2] [app_arg3] ... The feature could be implemented using a special boot-stub loader inside the jar which parses a custom manifest attribute and is executed instead of the Main-Class and then calls the main methode of the real Main-Class. But this might have side effects. Is this feature really needed? What about conflicts, if there are args in the launch-config and also args in the command-line?
Thanks Ferenc, no special class loader, no parsing, please. We should show a warning if program arguments are used. The solution for the user would be to do what VectorTest already does: add a main method like public static void main (String[] args) { junit.textui.TestRunner.run (new TestSuite(VectorTest.class)); } and create a runnable jar which runs this main method. Martin? Would that be acceptable?
I agree with Benno's comment 3: When we detect program and VM arguments in the launch configuration, we can warn the user in the wizard: 'Note: Program and VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR'
I will add an patch till friday, feri
Created attachment 84562 [details] patch for org.eclipse.jdt.ui, show info for launchconfigs with arguments
(In reply to comment #6) > Created an attachment (id=84562) [details] > patch for org.eclipse.jdt.ui, show info for launchconfigs with arguments > Patch is not good: 1. Open the create runnable jar wizard for the first time Is: Wizard shows error 'no launch configuration selected' Should: Wizards must never open with an error message, see http://www.eclipse.org/articles/Article-UI-Guidelines/Contents.html#Wizards 2. 'no launch configuration selected' should start with an uppercase 3. Remove the 'Note: ' part of the message, the info icon already indicates that this is a note 4. Change the severity from info to warning
Created attachment 84643 [details] patch2 for org.eclipse.jdt.ui, show info for launchconfigs with arguments removed error message for missing launch-config, set priority to warning, removed "note: " prefix.
(In reply to comment #8) > Created an attachment (id=84643) [details] > patch2 for org.eclipse.jdt.ui, show info for launchconfigs with arguments > > removed error message for missing launch-config, set priority to warning, > removed "note: " prefix. -The formatting is incorrect, enable format edited lines. -Remove unnecessary parenthesis. -Remove unnecessary local variables. -Something like: private String getLaunchConfigurationAttibute(String attributeName, String defaultValue) { String result = defaultValue; try { result = fLaunchConfiguration.getAttribute(...); } catch (CoreException e) { JavaPlugin.log(e); } return result; } Is easier to read if: private String getLaunchConfigurationAttibute(String attributeName, String defaultValue) { try { return fLaunchConfiguration.getAttribute(...); } catch (CoreException e) { JavaPlugin.log(e); return defaultValue; } } It's also faster (less assignments, less values on stack)
Created attachment 84806 [details] patch3 for org.eclipse.jdt.ui, show info for launchconfigs with arguments reformated code
Created attachment 84851 [details] fix
fixed > I20071204-1547