Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVA


  Using keytool to create certificate chain

JDK provides a command line tool -- keytool to handle key and certificate generation. This tool has a set of options which can be used to generate keys, create certificates, import keys, install certificate and export certificates etc. In this tutorial, we will show how to create certificate chain using keytool. If you want to understand how to create certificate chain programmably, please refer to Generate certificate in Java -- Certificate chain.To begin, we first generate a key pair which will be used as the CA, ts private key will be used to sign the certificate it issues.keytool -gen...

48,375 1       JAVA CERTIFICATE CERTIFICATE CHAIN KEYTOOL


  Multithreading interview questions in Java

Multithreading as a widespread programming and execution model allows multiple threads to exist within the context of a single process. These threads share the process' resources but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. However, perhaps the most interesting application of the technology is when it is applied to a single process to enable parallel execution on a multiprocessor system.Many programmers don't know how to use multithreading correctly, and we often get some advice from people regardin...

46,531 3       JAVA INTERVIEW MULTITHREADING


  Remote execute command in Java example

Frequently there is a need to logon to a remote system and run some commands or programs to get the output, many software can serve this purpose such as putty and gitshell.These software usually provide secure access to the remote system. But have you ever wondered what to do if you need to run commands on many different systems at the same time and get all these results back at a single place? Especially in big data era, many tasks may run on different distributed systems and you want o have a single place to accumulate the result.In this post, we will introduce a Java library which can help ...

45,672 11       JSCH EXAMPLE DISTRIBUTED SYSTEM SSH2


  Different types of keystore in Java -- JKS

JKS is Java Keystore, a proprietary keystore type designed for Java. It can be used to store private keys and certificates used for SSL communication, it cannot store secret keys however. The keytool shipped with JDKs cannot extract private keys stored on JKS. This type of keystore usually has an extension of jks.Next we will show how to operate the JKS keystore with pure Java code.Create JKS keystoreThe simplest method to create a JKS keystore to create an empty keystore. We can first get an instance of KeyStore and then load a null keystore. After loading the null keystore, we just need to c...

45,448 3       DEMO EXAMPLE KEYSTORE JKS


  Generate certificate in Java -- Certificate chain

In previous post, we have introduced the use of Certificate and how to generate self signed certificate using Java. In this post, we will show you how to generate a certificate chain. Sometimes we may only have a certificate request or we don't have a trusted certificate which can be used for business. Now we need to have a trusted CA to sign our certificate so that it can be used on SSL communications.To generate a certificate chain, we may first have our own certificate(A), then we may use other certificate(B) and its associated private key to sign the certificate we have, then we will use a...

40,715 2       JAVA CERTIFICATE CHAIN CREATION PURE JAVA


  Difference between ConcurrentHashMap and Hashtable

Both ConcurrentHashMap and Hashtable are Collection classes for storing key value pairs and they both provide fast element search with a supplied key. They have much in common. However, we will not discuss the similarities between them here, instead we will focus on the differences between them.ConcurrentHashMap and Hashtable are both thread safe. But the mechanism for thread safe is different between them. Hashtable is synchronized, it utilizes the synchronization mechanism; while ConcurrentHashMap uses segmentation to lock the data, it uses concurrent locks operations for thread safety inste...

40,461 3       CONCURRENTHASHMAP HASHTABLE


  Modal dialog in Java example code

In Java, we can create modal dialog so that the main JFrame cannot be operated on until the modal dialog is closed. To achieve this, we need to use one class in Java--JDialog. This class can be used to create an modal dialog.Example code :import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JPanel;public class Dialog extends JDialog{ public Dialog(){ super(); JPanel panel=new JPanel(); panel.add(new JLabel("Hello dialog")); this.getContentPane().add(panel); } public Dialog(MainFrame mf,String title,boolean modal){ super(mf,title...

40,255 2       JAVA CODE DEMO MODAL JFRAME JDIALOG


  Benefits and Drawback of a Layered Architecture

Most enterprises today are application centric. But the problem with the application is that their database schemas, user interfaces, programming interfaces and object models are tightly coupled and difficult to change. If you want to add a new field to a database table and you’re lucky, the change will reflect through the entire system. But often the change needs to be replicated manually across the entire system. And as applications are difficult to change, adding business rules or process to the application does not facilitate business agility. This is where layered architecture comes...

39,065 0       JAVA PROGRAMMING WEB DEVELOPMENT ENTERPRISE APPLICATION