Close resource quietly using try-with-resources

I found this answered on the coin-dev mailing list: http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001503.html 5. Some failures of the close method can be safely ignored (e.g., closing a file that was open for read). Does the construct provide for this? No. While this functionality seems attractive, it is not clear that it’s worth the added complexity. As a practical … Read more

Change background color editable JComboBox

see my code example import java.awt.*; import java.util.Vector; import javax.swing.*; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.metal.MetalComboBoxButton; public class MyComboBox { private Vector<String> listSomeString = new Vector<String>(); private JComboBox someComboBox = new JComboBox(listSomeString); private JComboBox editableComboBox = new JComboBox(listSomeString); private JComboBox non_EditableComboBox = new JComboBox(listSomeString); private JFrame frame; public MyComboBox() { listSomeString.add(“-“); listSomeString.add(“Snowboarding”); listSomeString.add(“Rowing”); listSomeString.add(“Knitting”); listSomeString.add(“Speed … Read more

java.security.cert.CertificateException: Certificates does not conform to algorithm constraints

Background MD2 was widely recognized as insecure and thus disabled in Java in version JDK 6u17 (see release notes http://www.oracle.com/technetwork/java/javase/6u17-141447.html, “Disable MD2 in certificate chain validation”), as well as JDK 7, as per the configuration you pointed out in java.security. Verisign was using a Class 3 root certificate with the md2WithRSAEncryption signature algorithm (serial 70:ba:e4:1d:10:d9:29:34:b6:38:ca:7b:03:cc:ba:bf), … Read more

How do I use JDK 7 on Mac OSX?

This is how I got 1.7 to work with Eclipse. I hope it helps. I Downloaded the latest OpenJDK 1.7 universal (32/64 bits) JDK from Mac OS/X branch from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html copied the jdk to /Library/Java/JavaVirtualMachines/ next to the default 1.6.0 one In Eclipse > Preferences > Java > Installed JREs you add a new one, … Read more

How to set IntelliJ IDEA Project SDK

For a new project select the home directory of the jdk eg C:\Java\jdk1.7.0_99 or C:\Program Files\Java\jdk1.7.0_99 For an existing project. 1) You need to have a jdk installed on the system. for instance in C:\Java\jdk1.7.0_99 2) go to project structure under File menu ctrl+alt+shift+S 3) SDKs is located under Platform Settings. Select it. 4) click … Read more