Skip to content
Software Testing Journal
Software Testing Journal

Your daily dose of learning!

  • Blog
  • Help Center
  • Video Playlist
  • Podcast & FAQ
  • Privacy Policy
Software Testing Journal

Your daily dose of learning!

Copy and paste Java code from the clipboard to your Eclipse

Dheeraj Gambhir, 2023-09-252023-09-25

Small but a cool and old trick for copy-pasting Java code in Eclipse. I have seen so many folks still doing this when they want to copy-paste the Java code from the net via clipboard in their Eclipse:

> Right-click on the target folder where you want the clipboard Java code

>New

>Create Class

>Give a name and then finally remove the default code in this class and paste the Java code from their clipboard.

You don’t need to do all this. Just Right-click on the target folder where you want the Java code and paste it from the clipboard or directly CTRL+V.

Nice- isn’t it?

Sample code:

package com.test.apiAutomation.test;

import java.util.HashMap;

import java.util.Map;

import org.testng.annotations.Test;

public class TestCopyPaste

{

@Test public static void testCopyPaste()

{

Map<String, String> formParams = new HashMap<String, String>();

formParams.put(“grant_type”, “hey”);

System.out.println(“It’s working, TADAAAA…”);

}

}

What Eclipse has done here? – It parsed the clipboard content and detected that Java code was available, so it made the necessary changes and then copied it.

If you find this post helpful, please share them with your colleagues and friends.

  • Facebook
  • Twitter
  • LinkedIn
  • Email
Automation EclipseJavaTips

Post navigation

Previous post
Next post
©2025 Software Testing Journal | WordPress Theme by SuperbThemes