This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 188643

Summary: Can't copy text between Netbeans and external applications
Product: platform Reporter: juan_au
Component: TextAssignee: Ralph Ruijs <ralphbenjamin>
Status: REOPENED ---    
Severity: normal CC: aplatypus, arnauldvm, gianneschif, gloin, jcstritt, markiewb, pjiricka, sssilver, ulfzibis, waynebeast
Priority: P3    
Version: 7.3.1   
Hardware: Other   
OS: Linux   
URL: http://forums.netbeans.org/viewtopic.php?t=7431
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=218447
Issue Type: DEFECT Exception Reporter:
Attachments: can not copy the content to netbeans
no copy paste

Description juan_au 2010-07-13 23:11:13 UTC
copy ctrl+c doesnt copy anything to the clipboard, only works inside the netbeans application but cant use ctrl+c to copy to use the text in any external application.
Comment 1 TrombaMarina 2011-02-03 21:52:35 UTC
I having this problem with NetBeans 6.8 and Ubuntu 10.04. When I copy from NetBeans I cannot paste to Gedit or Gnome Terminal (but I can to Emacs and OpenOffice). 

Since some applications work (Parcellite, OpenOffice, Emacs), the system clipboard must know about the copying and pasting done in NetBeans. Deadite81 suggests it's maybe not in the right format or not marked as text:
http://askubuntu.com/questions/3541/can-not-paste-into-terminal

I also read that NetBeans has some code to avoid deadlock when you are debugging an application and you pause the app you are debugging in the midst of a copy or paste operation and that this code is what causes the problem: 
Source: http://netbeans-org.1045718.n5.nabble.com/Can-t-copy-paste-in-ubuntu-terminal-td2957720.html

That makes sense, but for the rest of us, the rest of the time, maybe we could have a configuration checkbox called, "I know I'll be sorry if I try to debug a GUI app, but use the system clipboard anyway."
Comment 2 jyeary 2011-02-04 14:09:54 UTC
This has been brought up by members of my JUG/LUG community. It is not a P2 bug, but does affect usability of the application. It prevents use of other tools in combination with NetBeans.
Comment 3 TrombaMarina 2011-02-04 19:29:20 UTC
Verified still an issue with Netbeans 6.9 and Ubuntu 10.10.  None of the following will copy code from Netbeans for pasting into a terminal window:
Ctrl-C
Ctrl-Insert
Edit: Copy
Right-Click: Copy

Hmm... Interestingly, now they work on Gedit.  I don't have a problem cutting and pasting any other application to the terminal window.  I wonder if the problem is with NetBeans or with GNOME Terminal?

*WORKAROUND*
1.) Highlight text in NetBeans
2.) Middle-click in GNOME Terminal to paste it there

I was trying out editors yesterday and *almost* discounted NetBeans immediately when it failed to cut and paste the way I expected it to.  From a first-impression perspective I'd still say this deserves to be fixed, but for me personally, it's a much lower priority now that I have a good work-around.
Comment 4 Petr Jiricka 2011-03-01 16:15:49 UTC
Reassigning to editor.
Comment 5 David Strupl 2011-03-07 16:00:08 UTC
I am on Ubuntu 10.10 and it works for me.

If we want to resolve this we would need to know the exact JDK version used and whether plain java application (e.g. plain swing text editor) work ok. It might be problem of JDK vs the rest of the OS. Only in case it is NetBeans specific we might want to try to tackle this - if there is a way to reproduce here.
Comment 6 sssilver 2012-02-09 16:02:36 UTC
Still getting the issue on Gentoo/Openbox. Running pretty much the cutting edge versions of everything.

Product Version: NetBeans IDE 7.1 (Build 20120119-unknown-revn)
Java: 1.6.0_22; OpenJDK 64-Bit Server VM 20.0-b11
System: Linux version 3.2.5-gentoo running on amd64; ANSI_X3.4-1968; en_US (nb)

Pasting to some editors (like gedit) and then copying from there works OK. pasting in the browser textareas does not work. Pasting in the browser address bar works.

I guess it's a formatted text vs plain text issue.
Comment 7 pavon 2012-03-09 19:02:04 UTC
I just upgraded to 7.1 from 6.9 and am having this problem. Text I copy in other applications can't be pasted into Netbeans and vice versa. My system information is:

Product Version: NetBeans IDE 7.1.1 (Build 201203012225)
Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b16
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

So it's not limited to Linux/X11 systems (or there are multiple bugs with the same symptoms).
Comment 8 Svata Dedic 2012-03-12 13:58:37 UTC
(In reply to comment #6)
> Pasting to some editors (like gedit) and then copying from there works OK.
> pasting in the browser textareas does not work. Pasting in the browser address

What browser ? 

I've tried to copy a portion of java code from NB to:

* LibreOffice spreadsheet
* Chromium text area
* Kosnole (KDE terminal emulator)

everything worked OK.

My environment is:
* Ubuntu Linux 11.04
* Linux 3.0.0-11-generic #17-Ubuntu SMP Sat Sep 10 13:38:59 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
* Netbeans dev (20120312)

Could you please give an example of what are you trying to copy that cannot be pasted ?
Comment 9 sssilver 2012-03-14 15:37:10 UTC
Now it works!

Product Version: NetBeans IDE 7.1.1 (Build 20120306-unknown-revn)
Java: 1.6.0_24; OpenJDK 64-Bit Server VM 20.0-b12
System: Linux version 3.2.1-gentoo-r2 running on amd64; ANSI_X3.4-1968; en_US (nb)

I wonder what's changed.
Comment 10 TrombaMarina 2012-03-14 16:28:22 UTC
When people say "copy and paste" they need to be specific if they want others to be able to duplicate the issue.  Some old *nix-heads use "paste-primary-selection" where they highlight some text in one app, then hit the middle mouse button in another app.  In my experience, when paste-primary-selection works (some apps don't support it, or support it differently), it works in NetBeans.  I do not think that's what this bug is about.

This bug report has to do with using the system clipboard, not primary-selection.  Using the keyboard, that's CTRL-C in one app, then CTRL-V in another.  For mouse junkies: Right-click Copy in one app, Right-click Paste in another.

Bug reporters need to be specific which copy/paste method they are using (primary-selection, CTRL-C/CTRL-V, or Mouse menus) and whether NetBeans is the source or destination app for the failed copy/paste.  People trying to duplicate the issue might want to try all three methods in both directions.
Comment 11 melb 2012-04-01 16:58:54 UTC
Setup is a completely fresh installation of 7.1.1 ( All ) on XP SP2, and a new blank SE project.

My first Copy and Paste of code ( text ) from a Firefox page was OK.

My second Copy and Paste, wholly within Netbeans, of code from the first copy and paste was also OK.

However, my third Copy and Paste fails. I copy some more code from another Firefox page - I see in Notepad that it has been copied OK - but it will not Paste in Netbeans. The code from my second Copy and Paste gets pasted instead. I've tried Edit/Paste, Keyboard Shortcuts and Mouse - same result with all methods. The fault is solid.

However, I was close, but did not give up with Netbeans and did something else and now can cut and paste OK!

The reason why I reported this is that this Cut/Paste sequence reproduces the problem to order.

Mel
Comment 12 conner_bw 2012-05-03 15:11:05 UTC
Happens to me, too.

I cannot copy paste from Netbeans to the Terminal.

Copying from Netbeans to gedit works fine, though.


Netbeans 7.1.2
Ubuntu 12.04 LTS
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Comment 13 Jiri Prox 2012-05-04 07:21:10 UTC
Maybe related to issue 205697
Comment 14 Stanislav Aubrecht 2012-05-04 08:00:43 UTC
Please reopen if this problem is reproducible also with Oracle JDK, thanks.
Comment 15 mrucis 2012-05-23 09:24:08 UTC
Had same problem on NetBeans 7.0 and Ubuntu 10.04 now using Ubuntu 12.04 and NetBeans 7.1.2 same thing.
Now using java:
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
Comment 16 mrucis 2012-05-23 09:25:59 UTC
Had same problem on NetBeans 7.0 and Ubuntu 10.04 now using Ubuntu 12.04 and NetBeans 7.1.2 same thing.
Now using java:
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
Comment 17 Stanislav Aubrecht 2012-05-24 08:21:13 UTC
Please provide exact steps to reproduce and reopen, thanks.
Works fine for me in: 
Product Version: NetBeans IDE 7.1.2 (Build 201204101705)
Java: 1.6.0_32; Java HotSpot(TM) Client VM 20.7-b02
System: Linux version 3.2.0-23-generic-pae running on i386; UTF-8; en_US (nb)
Comment 18 waynebeast 2013-02-28 20:33:42 UTC
I am running Netbeans 7.2 on Win7 64-bit. The problem only happens once in a while. I am not sure the exact steps to reproduce this problem. This has happened to me when copying from VirtualBox, Notepad, Notepad++, Chrome, Firefox, LibreOffice. Example: today, I was trying to copy a bunch of data from LibreOffice to Netbeans, the data that I previously copied inside Netbeans shows up when I did the paste action. I tried pasting the LibreOffice data into Notepad and the expected data showed up. I tried copying the data from Notepad to Netbeans, still did not work. So it seems that the data in the Windows clipboard is not being syncrhonized with Netbeans' clipboard.
Comment 19 waynebeast 2013-02-28 20:37:33 UTC
I just restarted Netbeans, now copy and pasting works again. This is the system info:

Product Version: NetBeans IDE 7.2 (Build 201207171143)
Updates: Updates available
Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\...\AppData\Roaming\NetBeans\7.2
Cache directory: C:\Users\...\AppData\Local\NetBeans\Cache\7.2
Comment 20 Stanislav Aubrecht 2013-06-04 15:14:40 UTC
Please reopen if reproducible in NetBeans 7.3 or in recent dev builds, thanks.
Comment 21 talsibo 2013-07-25 11:28:54 UTC
Hi,

I have the same issue when I copy some text from netbeans and try to paste it using Ctrl + v to other application both freezes netbeans and chrome, netbeans and texteditor.

here is my system Info:
Memory: 3.8 GiB
Processor: Intel® Core™ i7-2620M CPU @ 2.70GHz × 4 
Os type: 64-bit ubuntu 12.04 LTS
Disk: 121.9 GB 34 GB free

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Updates: Updates available to version NetBeans 7.3 Patch 2
Java: 1.6.0_27; OpenJDK 64-Bit Server VM 20.0-b12
Runtime: OpenJDK Runtime Environment 1.6.0_27-b27
System: Linux version 3.5.0-37-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/tal/.netbeans/7.3
Cache directory: /home/tal/.cache/netbeans/7.3
Comment 22 ulfzibis 2013-07-25 12:18:56 UTC
Hi talsibo,

why didn't you reopen the bug?
Comment 23 talsibo 2013-07-28 10:50:02 UTC
Hi,

I wasn't sure I am allowed to reopen it as a bug after your question I was realized that I should reopen this bug.

please note that this issue suddenly appeared after I was updating ubuntu.
I use netbeans for PHP development and really like it this issue is very annoying because it causes to all my system to stuck, for example if I try to do copy and paste from netbeans to chrome both get stuck, chrome and netbeans.

Do you have any suggestions of how can I help resolving this issue?
(providing logs..)
Comment 24 gloin 2013-07-30 12:13:21 UTC
Had the same issue with Ctrl+C and Ctrl+V (while pasting with middle-mouse button worked fine) this morning, probably after system update. It affected Netbeans 7.2 and Netbeans 7.3.1.
Seems it was a problem with OpenJDK 6

However, I could resolve it with the following steps:
1. In Synaptic, I installed openjdk-7-jre
2. In ~/netbeans-7.x/etc/netbeans.conf changed the line
netbeans_jdkhome="/usr/lib/jvm/default-java"
to
netbeans_jdkhome="/usr/lib/jvm/java-7-openjdk-i386/jre"

For completeness, my current configurations:

Netbeans 7.3.1
Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.7.0_25; OpenJDK Client VM 23.7-b01
Runtime: OpenJDK Runtime Environment 1.7.0_25-b30
System: Linux version 3.2.0-51-generic running on i386; UTF-8; de_DE (nb)

Netbeans 7.2
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_25; OpenJDK Client VM 23.7-b01
System: Linux version 3.2.0-51-generic running on i386; UTF-8; de_DE (nb)
Comment 25 Miloslav Metelka 2013-08-19 12:44:25 UTC
If NB got stuck you could possibly provide a thread dump e.g. with jstack and attach it to the issue.
Since changing JDK helps to resolve the problem I mark the issue as invalid.
Comment 26 java_qb 2014-07-24 20:01:21 UTC
I'm unable to cut and paste from NotePad to NB 8.0. This looks like a very old issue. Is there a fix that I'm missing?

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 2
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 27 taihanh 2014-08-04 03:15:08 UTC
Created attachment 148505 [details]
can not copy the content to netbeans
Comment 28 taihan 2014-11-11 06:53:38 UTC
Created attachment 150413 [details]
no copy paste
Comment 29 idclaar 2015-01-21 01:39:16 UTC
I've run into this issue before in several different versions of the IDE.  Stopping and restarting the IDE usually fixes the issue, at least right after the IDE has been restarted.  I'd say this happens to me about once a month on average.  Has anyone else noticed that restarting clears it up for them for a while?
Comment 30 john.schmalenberg 2015-01-23 16:17:36 UTC
(In reply to idclaar from comment #29)
> I've run into this issue before in several different versions of the IDE. 
> Stopping and restarting the IDE usually fixes the issue, at least right
> after the IDE has been restarted.  I'd say this happens to me about once a
> month on average.  Has anyone else noticed that restarting clears it up for
> them for a while?

I run into it every once in a while. Seems like it might be a memory issue as it only ever happens to me when Netbeans has been open for a long time and is running at close to the max amount of memory I give it (6GB). Restarting always fixes it for me.
Comment 31 Son 2015-03-31 08:43:36 UTC
Problem is back. I have NB 8.0.2 and when I try Copy-Paste from external app I have empty/old data in clipboard.

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 1
Java: 1.7.0_71; Java HotSpot(TM) 64-Bit Server VM 24.71-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_71-b14
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 32 Flash1212 2015-04-21 03:33:06 UTC
I too am experiencing this problem. 

I found that if I closed all my projects and restarted NetBeans it would again let me copy from external sources.

Product Version = NetBeans IDE 8.0.2 (Build 201411181905)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_40
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.40-b25
Comment 33 evgenic 2015-07-06 11:11:58 UTC
That is true. Copy-paste is broken in NB8.0.2. What to do? Copy-paste just inside NB(maybe couple of times) and you can copy into NB from outside.
Comment 34 ricardowong 2015-07-31 04:32:40 UTC
I am having trouble pasting formatted text to netbeans (such as a website), but have had success by stripping format and pasting plain text. Copied text from plain text sources can be pasted with no trouble. If copied text is not plain text, Netbeans keeps pasting the previous successful clipboard.
Comment 35 Jiri Prox 2015-08-24 13:22:26 UTC
*** Bug 254493 has been marked as a duplicate of this bug. ***
Comment 36 jcstritt 2015-11-20 23:34:41 UTC
Same bug in NetBeans 8.1 on a Mac with OS 10.11.1
Comment 37 markiewb 2015-11-22 23:27:40 UTC
(In reply to jcstritt from comment #36)
> Same bug in NetBeans 8.1 on a Mac with OS 10.11.1

@jcstritt: Please do not change the versions-field. 
The version states the version the issue first appeared.
The target milestone is set by the developers only.

So reverting the version field changes.
Comment 38 TheSecondPower 2016-01-05 17:03:33 UTC
Same bug in NetBeans 8.1 on a PC with Windows 7 SP1 amd64 on Java 8 64-bit update 66.
Comment 39 Ralph Ruijs 2016-05-19 07:43:52 UTC
This should be fixed in the latest dev build. There where some inconsistencies between the different TransferHandlers.
Comment 40 ggghhhjjj 2016-10-23 22:39:04 UTC
I've just switched to 8.2 from 8.1 because of the copy-paste problem. Unfortunately, in the 8.2 version the problem is still available. For example, I cannot paste the git repository URL into the text edit box inside the Team->Git->Clone dialog wizard.
It is very inconvenient. In my opinion the bug severity must be raised.
I'm using OS X El Capitan 10.11.6.

Note that both pastes do not work: Command + V and Right click no context menu.
Comment 41 Ralph Ruijs 2016-10-24 07:01:39 UTC
(In reply to ggghhhjjj from comment #40)
> I've just switched to 8.2 from 8.1 because of the copy-paste problem.
> Unfortunately, in the 8.2 version the problem is still available. For
> example, I cannot paste the git repository URL into the text edit box inside
> the Team->Git->Clone dialog wizard.
> It is very inconvenient. In my opinion the bug severity must be raised.
> I'm using OS X El Capitan 10.11.6.
> 
> Note that both pastes do not work: Command + V and Right click no context
> menu.

Copy pasting into text boxes is different from copy pasting into the editor. Please create a new issue describing the problem with steps to reproduce. From the looks of it, please also enclose a list of applications and os extensions. Thanks!
Comment 42 xantiva 2016-10-30 20:32:38 UTC
Same problem with Netbeans 8.2, Windows 10, Java 8.111:

This very old copy 'n' paste bug ...
Sometimes I copy some text from outside Netbeans and want to paste it elsewere (editor, searchbox, ...) but it pastes always the old content from the "netbeans" switchboard.
Comment 43 JohannesU 2017-02-21 14:12:51 UTC
NetBeans 8.1, jdk1.8.0_121 amd64, Windows 7
I know that I don't use the latest release, but just in case the same error happens again in future, here is a workaround:
1. select and copy a space character from any editor tab inside NetBeans
2. copy your external content again. Pasting should work then.
Comment 44 IfElseTrue 2017-04-11 07:47:42 UTC
Still not working in NB 8.2. It works for a while ca 30 mins may be more. And then stops. Restart IDE helps. Really, annoying
Comment 45 Adeel 2017-07-25 05:56:35 UTC
Same problem on
Ubuntu 17.04
netbeans 8.2

I can't copy from netbeans to libreoffice but
Can copy to gedit.
Comment 46 b_f_ 2017-11-14 13:27:23 UTC
(In reply to juan_au from comment #0)
> copy ctrl+c doesnt copy anything to the clipboard, only works inside the
> netbeans application but cant use ctrl+c to copy to use the text in any
> external application.

Still present in 8.2. on Win10 Pro. Tends to occur in .java code window when starting some other app like Oracle SQL Developer, but this event is not necessarily related.