Copy To Clipboard Doesn’t work in Java

Writing by on Friday, 30 of May , 2008 at 10:59 am

We recently migrated from Java 4 to Java 6 and found out that Copy To Clipboard from JTable, JTextBox etc. just didn’t work.

String selection = “Clip This”;
StringSelection data = new StringSelection(selection);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(data, data);

Then I happened to notice that there was an exception on startup and it couldn’t find flavormap.properties.

FileNotFoundException:C:\Program%20Files\Java\jre1.6.0_06\lib\flavormap.properties

It occurred to me at that point that the there was a SPACE in the location “Program Files” and God Knows why thats not handled correctly. So I simply uninstalled Java 6 from its Default Location and reinstalled it in C:\jdk1.6.0_6 and that did it for me.


Change Default Install Location
I did a lot of searching for solutions, but looks like nobody else ran into this problem. Hey, fixing these type of issues is what we developers get paid for, right? But Microsoft, Sun – PLEASE – Don’t point fingers at each other. Just handle these issues.

Leave a comment

Category: Java

SQL Server First, Last Aggregate Functions

Writing by on Tuesday, 20 of May , 2008 at 4:01 pm

Are you getting a SQL Server error saying that FIRST or LAST are not recognized or unsupported?

Error:’FIRST’ is not a recognized built-in function name. Number:195 Severity:15 State:10

Thats because they’re not.

SELECT LotFk, FIRST(RedemptionPeriodDate) as RedemptionPeriodDate -- ERROR 
FROM InvRegister
GROUP BY LotFk

Workaround is to use MIN or MAX

SELECT LotFk, MIN(RedemptionPeriodDate) as RedemptionPeriodDate -- VALID
FROM InvRegister
GROUP BY LotFk

Leave a comment

Category: SQL DB

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.