Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312397 - Run Configuration Command Line to Clipboard
Summary: Run Configuration Command Line to Clipboard
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 4.9 M2   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 537126 (view as bug list)
Depends on: 537912 537879 537880
Blocks:
  Show dependency tree
 
Reported: 2010-05-11 06:41 EDT by Juergen Weber CLA
Modified: 2019-08-01 15:06 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Weber CLA 2010-05-11 06:41:58 EDT
Build Identifier: 20100218-1602

A run configuration should provide a command line, i.e. it should get the full command line argument to run the run configuration in a unix shell.
There should be a button to get this line into the clipboard.
Afterwards you'd open a unix shell in the project directory and paste the command line string and run the command.
This would be useful to run several times the program in parallel in different shells. 
The information should be easy to get, as it is also needed to build a runnable jar.

Reproducible: Always
Comment 1 Remy Suen CLA 2010-05-11 07:35:59 EDT
This sounds like a noble cause.

(In reply to comment #0)
> A run configuration should provide a command line, i.e. it should get the full
> command line argument to run the run configuration in a unix shell.

In the meantime, you can get it from the process's properties.
http://wiki.eclipse.org/Graphical_Eclipse_FAQs#How_do_I_check_for_the_command_line_invocation_that_Eclipse_used_to_launch_an_application.3F
Comment 2 Stephan Herrmann CLA 2017-11-13 16:07:26 EST
We recently had a conversation about this (in a very nice environment :) ), but I don't recall if we came to an agreement nor what exactly it said. I remember we discussed various tabs and all had some disadvantage or other.

Let me throw in a few more ideas:

(1) What about a button in the left-hand column, just next to the "New", "Duplicate" and "Delete" buttons. Remaining challenge: naming & icon to clearly distinguish the two kinds of copying.

(2) What about a (live) label left of [Revert] [Apply] (i.e., *below* the tab folder)? For non-trivial launches that label will of course be truncated, so an explicit 'copy-to-clipboard' button next to the label would be cool (probably using an icon rather than text to save space).

I think I like (2) best, because it will give people an immediate idea of what this is all about.
Comment 3 Sarika Sinha CLA 2017-11-14 00:10:56 EST
Even I like the Idea(2) but I don't like showing the truncated command line.

May be we can have a button left to "Revert" labelled something like "Get Command Line". Clicking on that can open a dialog to show the command line and a copy command like we have as "Copy Build Info".

From Implementation perspective, we can give the framework in Platform Debug and any of the adopters like JDT,Junit,PDE etc can provide there information of commandline to support this. If they don't support, there will be no such button.
Comment 4 Sarika Sinha CLA 2018-04-17 00:59:33 EDT
This needs API changes. I do want to do this in M1 of next release.
Comment 5 Sarika Sinha CLA 2018-07-18 10:17:29 EDT
*** Bug 537126 has been marked as a duplicate of this bug. ***
Comment 6 Ed Willink CLA 2018-07-18 11:51:58 EDT
(In reply to Sarika Sinha from comment #5)
> *** Bug 537126 has been marked as a duplicate of this bug. ***

... where I suggest a copyable area at the foot of the Arguments Tab.

As well as supporting those users who must have a non-EClipse command line, it could be a valuable debgging / lrarning aid for modular classpaths.
Comment 7 Sarika Sinha CLA 2018-07-27 01:20:14 EDT
Will be putting the patch today. 
I am going ahead with the "Show Command Line" Button on the left of Revert Button.
Button will show a dialog with command line text having Copy and Cancel buttons.
Comment 8 Eclipse Genie CLA 2018-07-27 12:43:43 EDT
New Gerrit change created: https://git.eclipse.org/r/126713
Comment 9 Eclipse Genie CLA 2018-07-27 12:50:04 EDT
New Gerrit change created: https://git.eclipse.org/r/126716
Comment 10 Till Brychcy CLA 2018-07-27 13:52:35 EDT
Very nice!

Would it be hard to make the popup that shows the command line resizable?
Comment 11 Sarika Sinha CLA 2018-07-27 21:02:27 EDT
(In reply to Till Brychcy from comment #10)
> Very nice!
> 
> Would it be hard to make the popup that shows the command line resizable?

Releasing the current version for now,so that we can get in the build. 
Will try to make it resizable.
Comment 14 Eclipse Genie CLA 2018-07-28 17:02:45 EDT
New Gerrit change created: https://git.eclipse.org/r/126727
Comment 16 Andrey Loskutov CLA 2018-07-28 17:21:48 EDT
(In reply to Eclipse Genie from comment #15)
> Gerrit change https://git.eclipse.org/r/126727 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/
> ?id=199c5f6d5ca19fb9781572c3b62c739a1055f940

Fixes 11 test errors, see http://download.eclipse.org/eclipse/downloads/drops4/I20180728-0805/testresults/html/org.eclipse.jdt.ui.tests_ep49I-unit-cen64-gtk3_linux.gtk.x86_64_8.0.html
Comment 17 Eclipse Genie CLA 2018-07-29 16:06:01 EDT
New Gerrit change created: https://git.eclipse.org/r/126746
Comment 18 Sarika Sinha CLA 2018-07-29 16:14:12 EDT
(In reply to Andrey Loskutov from comment #16)
> (In reply to Eclipse Genie from comment #15)
> > Gerrit change https://git.eclipse.org/r/126727 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/
> > ?id=199c5f6d5ca19fb9781572c3b62c739a1055f940
> 
> Fixes 11 test errors, see
> http://download.eclipse.org/eclipse/downloads/drops4/I20180728-0805/
> testresults/html/org.eclipse.jdt.ui.tests_ep49I-unit-cen64-gtk3_linux.gtk.
> x86_64_8.0.html

Thanks Andrey!!
Comment 19 Sarika Sinha CLA 2018-07-29 16:14:36 EDT
(In reply to Eclipse Genie from comment #17)
> New Gerrit change created: https://git.eclipse.org/r/126746

Making the dialog resizable.
Comment 21 Till Brychcy CLA 2018-07-30 15:05:01 EDT
(In reply to Sarika Sinha from comment #19)
> (In reply to Eclipse Genie from comment #17)
> > New Gerrit change created: https://git.eclipse.org/r/126746
> 
> Making the dialog resizable.

Thanks!

One thing I noted is that if you change anything, the result of "Show Command Line" corresponds to the unchanged state, so you have to click "Apply" first.
The way the buttons are places somehow suggests that this always should match the current possible un-applied settings.
(e.g. if you add a project to the classpath or toggle the "Exclude Test Code"-Setting.)
Comment 22 Sarika Sinha CLA 2018-07-30 22:53:27 EDT
(In reply to Till Brychcy from comment #21)
> 
> Thanks!
> 
> One thing I noted is that if you change anything, the result of "Show
> Command Line" corresponds to the unchanged state, so you have to click
> "Apply" first.
> The way the buttons are places somehow suggests that this always should
> match the current possible un-applied settings.
> (e.g. if you add a project to the classpath or toggle the "Exclude Test
> Code"-Setting.)

Possibly, we can show a warning, do you want to Apply if there are unsaved changes?
Comment 23 Till Brychcy CLA 2018-07-31 02:20:39 EDT
(In reply to Sarika Sinha from comment #22)
> (In reply to Till Brychcy from comment #21)
> > 
> > Thanks!
> > 
> > One thing I noted is that if you change anything, the result of "Show
> > Command Line" corresponds to the unchanged state, so you have to click
> > "Apply" first.
> > The way the buttons are places somehow suggests that this always should
> > match the current possible un-applied settings.
> > (e.g. if you add a project to the classpath or toggle the "Exclude Test
> > Code"-Setting.)
> 
> Possibly, we can show a warning, do you want to Apply if there are unsaved
> changes?

A warning is a possible solution.
But I'd prefer to either auto-apply changes like the "Run"-Button does (in which case it would make more sense to have the button next to the "Close" and "Run" buttons, if this isn't too much work) or, even better, leave the button where it is and show the commmand line how it would look if the changes were applied (but without actually applying them) - again, if this is not too much work.
Comment 24 Till Brychcy CLA 2018-07-31 02:57:31 EDT
Another little issue: It looks like the command line shows is always the "Run" command line, even if I opened it as "Debug" configuration.
Comment 25 Eclipse Genie CLA 2018-07-31 03:19:10 EDT
New Gerrit change created: https://git.eclipse.org/r/126804
Comment 27 Sarika Sinha CLA 2018-07-31 04:50:32 EDT
(In reply to Till Brychcy from comment #23)
> 
> A warning is a possible solution.
> But I'd prefer to either auto-apply changes like the "Run"-Button does (in
> which case it would make more sense to have the button next to the "Close"
> and "Run" buttons, if this isn't too much work) or, even better, leave the
> button where it is and show the commmand line how it would look if the
> changes were applied (but without actually applying them) - again, if this
> is not too much work.

Created Bug 537525.

Added N&N.

Will fix the Run mode problem :) Just added for testing and forgot to change - thanks!!
Comment 28 Eclipse Genie CLA 2018-07-31 04:55:44 EDT
New Gerrit change created: https://git.eclipse.org/r/126812
Comment 30 Till Brychcy CLA 2018-07-31 06:32:27 EDT
(In reply to Eclipse Genie from comment #29)
> Gerrit change https://git.eclipse.org/r/126812 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/
> ?id=b6969eee271609c54a23356f4cd642c3c42ca68c

With this I can see some debug options (like the -javaagent for advanced source lookup) but e.g. the -agentlib parameter is missing (and -Dfile.encodiing=...):

Output of "Show command line":
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/java -javaagent:/Users/till/Applications/Eclipse4.9I20180729-2000.app/Contents/Eclipse/../../../../opensource/eclipse/eclipse.jdt.debug/org.eclipse.jdt.launching/lib/javaagent-shaded.jar -p /Users/till/Documents/workspaces/test-production/m1/bin -m m/p1.P1

Command Line shown in the Process properties:
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:60371 -javaagent:/Users/till/Applications/Eclipse4.9I20180729-2000.app/Contents/Eclipse/../../../../opensource/eclipse/eclipse.jdt.debug/org.eclipse.jdt.launching/lib/javaagent-shaded.jar -Dfile.encoding=UTF-8 -p /Users/till/Documents/workspaces/test-production/m1/bin -m m/p1.P1

Another minor quirk: I have some old launch configurations, where the jvm is missing, so an error is shown. "Run" is disabled in this case, but "Show Command Line" is enabled, but doesn't show anything.
Comment 31 Sarika Sinha CLA 2018-07-31 23:28:51 EDT
Ok, the missing debugging options can be added easily.

For enabling/disabling I need to check out.
Comment 32 Eclipse Genie CLA 2018-08-01 05:54:27 EDT
New Gerrit change created: https://git.eclipse.org/r/126878
Comment 33 Eclipse Genie CLA 2018-08-01 05:55:09 EDT
New Gerrit change created: https://git.eclipse.org/r/126879
Comment 36 Sarika Sinha CLA 2018-08-01 06:12:56 EDT
(In reply to Sarika Sinha from comment #31)
> Ok, the missing debugging options can be added easily.
> 
> For enabling/disabling I need to check out.

Released fixes for both.
Comment 37 Till Brychcy CLA 2018-08-01 07:15:04 EDT
(In reply to Sarika Sinha from comment #36)
> Released fixes for both.

Thanks, The button is disabled on errors and I can see the -agentlib now, but the -Dfile.encoding is still missing:

(In reply to Till Brychcy from comment #30)
> With this I can see some debug options (like the -javaagent for advanced
> source lookup) but e.g. the -agentlib parameter is missing (and
> -Dfile.encodiing=...):
> [...] 
> Eclipse/../../../../opensource/eclipse/eclipse.jdt.debug/org.eclipse.jdt.
> launching/lib/javaagent-shaded.jar -Dfile.encoding=UTF-8 -p
                                     ^^^^^^^^^^^^^^^^^^^^^
> /Users/till/Documents/workspaces/test-production/m1/bin -m m/p1.P1
> [...]
Comment 38 Sarika Sinha CLA 2018-08-02 04:10:26 EDT
(In reply to Till Brychcy from comment #37)

> (In reply to Till Brychcy from comment #30)
> > With this I can see some debug options (like the -javaagent for advanced
> > source lookup) but e.g. the -agentlib parameter is missing (and
> > -Dfile.encodiing=...):
> > [...] 
> > Eclipse/../../../../opensource/eclipse/eclipse.jdt.debug/org.eclipse.jdt.
> > launching/lib/javaagent-shaded.jar -Dfile.encoding=UTF-8 -p
>                                      ^^^^^^^^^^^^^^^^^^^^^
> > /Users/till/Documents/workspaces/test-production/m1/bin -m m/p1.P1
> > [...]

The launch property is not set during Show Command Line but the attribute is set during launch, Will investigate and update in the follow up bug 537525.

Eclipse SDK

Version: 4.9
Build id: I20180801-2000
Comment 39 Dani Megert CLA 2018-08-10 09:44:18 EDT
For me this is not fixed but just a very first step. All other Java related launch configs in the SDK must also support this. Yes, I've read comment 3, but I see no follow-up activities that plan to fix it in the other components for 4.9.
Comment 40 Sarika Sinha CLA 2018-08-12 23:15:20 EDT
Created Bug 537880 and Bug 537879 in PDE and JDT UI respectively.
Comment 41 Dani Megert CLA 2018-08-13 03:43:15 EDT
Let's close this and track the remaining work in the new bugs.
Comment 42 Sarika Sinha CLA 2018-08-14 01:16:17 EDT
Added a wiki page for adopters like PDE and JUnit.
https://wiki.eclipse.org/LaunchConfigurationShowCommandLine