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

 ALL


  Fix issue where no Java virtual machine found when launching Eclipse

In cases where a new Eclipse is installed or the location of the Java virtual machine binaries has been changed, you may face issue when launching Eclipse. The error would look like.And if you go to the location specified in the error message, there is no such path indeed. And when clicks OK, the program just exits. The issue here is that it tries to find the java.exe binary and launch the program but it failed to locate it and hence exits.To fix this, you first need to ensure you have Java installed on your system no matter it's a JRE or JDK. Then navigate to the Eclipse installation pat...

2,800 0       JAVA LAUNCH ECLIPSE ECLIPSE.INI


  The difference between System.load and System.loadLibrary in Java

When writing code using native library in Java, normally the first step is loading some native library.static{  System.load("D:" + File.separator + "Hello.dll");}JDK provides two ways to load libraries:System.load(String filename)System.loadLibrary(String libname)This post will try to explain the differences of these two ways.According to Java Doc on System.load(), it has below description.Loads the native library specified by the filename argument. The filename argument must be an absolute path name.The parameter of this method should be an absolute file path with the exten...

25,457 1       SYSTEM.LOADLIBRARY SYSTEM.LOAD JAVA JNI NATIVE


  Java Interview Questions

Currently there are many articles online which summarize the list of Java interview questions. Some cover lots of basic questions and some cover some specific questions in specific area such as multithreading. In this post, we will not cover the really basic questions, we will cover something different. For basic question, you can read Java Interview Questions。BasicWhat is primitive data type? How many primitive data types in Java? What are they?-- A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other ...

8,926 0       JAVA SECURITY INTERVIEW CAREER MULTITHREADING QUESTION JAVA INTERVIEW JAVA CORE


  Why using + to concatenate string in Java loop is not a good option

String concatenation is a common operation in Java programming. It is to concatenate multiple strings into a single string. Java provides a String class which is an immutable class which means the object cannot be mutated once instantiated.Once a String object is instantiated, its properties cannot be changed anymore, so when concatenating strings, it's actually create a new String instance to store the concatenated string values. For example, below is a simple string concatenation example.String s = "abcd";s = s.concat("ef");When this piece of code is executed, a new String instance is create...

9,814 0       JAVA 8 STRING JAVA


  Why can System.out.println be used to exit while loop

Let's first take a look at one simple Java thread code snippet which is supposed to exit the while loop after the first loop run.public class StopThread { private static boolean stopRequested; public static void main(String[] args) throws InterruptedException { Thread backgroundThread = new Thread(new Runnable() { @Override public void run() { int i = 0; while (!stopRequested) { i++; } } }); backgroundThread.start(); TimeUnit.SECONDS.sleep(1); stopRequested = true; }}But the truth is that the loop may not exit and keep running. The reason is that the updated stopRequested value will be in the ...

2,298 0       JAVA THREAD VOLATILE


  Is Python all set to triumph over Java?

Python is one of the top programming languages of the present time. A variety of companies with different backgrounds and offerings have embraced the capabilities of Python to make wonderful tech products. As, Java is also known to be one of the most recognized languages, therefore, there is a constant battle that takes place between the two languages. Python wants to dethrone Java as the number one, whenever it is and vice versa. It is like the tussle between Android and iOS which is never ending. Both of the languages were introduced to the world in the 90’s.Shortly after the emergence...

1,726 0       DEVELOPMENT JAVA PYTHON DJANGO


  How to Set Spring profile With Example

Technology:  Spring Profiles provides a way to isolates the parts of application configuration, it will make available only in certain environments. It is mainly useful it wants to load spring beans based on environment configuration, for example if the operating system is windows we can load some specific spring beans, if it is other than load different spring beans. One more scenario where spring profiles widely used, like for QA environment we will use some database which is hosted locally, for UAT we will use some different host database, for production it will vary, in this scenario`...

16,390 0       SPRING APPLICATIONS PROFILE DEVELOPMENT JAVA


  Why exception would be thrown when deleting element while looping through HashMap in Java

HashMap and other Collection types are frequently used in Java application programming. This post will explain why exception would be thrown when deleting element with Map.remove() while looping through a Map using Iterator. This issue would also occur to other Collection types such as Set, List.Below is a sample code snippet demonstrating the exception thrown.Map<String,String> map = Collections.synchronizedMap(new TreeMap<String,String>()); map.put("key1","value1");map.put("key2","value2");map.put("key3","value3"); Set<Entry<String,String>> entries = map.entrySet(); I...

3,334 0       JAVA HASHMAP CONCURRENTMODIFICATIONEXCEPTION