Serial Port Communication in Java

Sometimes, we need to deal with hardware or external devices from a Java application. One of the options how to communicate with them is to use the COM port (also known as serial port inteface) of the PC. Serial port is not only allows you a direct cable connection via physical ports, but it can also establish a connection via virtual ports for Bluetooth, Wi-Fi devices, and etc.

Java applications are executed in Java Virtual Machine (JVM), therefore, they have not direct access to individual memory address and can not communicate directly with any hardware devices. In contrast, C/C++ programming languages allow you to directly access memory address and thereby access to the hardware. What about the use of the C feature to communication with hardware and then call created C functions from Java?

Continue reading

How to call a C/C++ function from Java

Java Native Interface (JNI), part of the Java platform, is an interface that enables communication between Java applications running on a Java Virtual Machine (JVM) and native applications or libraries written in other programming languages (e.g. C, C++).

JNI provides improved performance in some low-level tasks (e.g. Math.sqrt (double a)) and enables communication with hardware devices (Bluetooth, Wi-Fi, etc.). However, there is a disadvantage in the loss of platform independence, because such program uses the library compiled for specific operating system.

Continue reading

What is webometrics?

Webometrics is a scientific discipline that studies the quantitative aspects of information sources and their use. In other words, webometrics try to measure the World Wide Web, analyses technology usage and allows us a simple content analysis. As Figure 1 shows, webometrics is affected by many scientific disciplines:

  • Bibliometrics – is the quantitative analysis of documents in scientific communication; the documents reflect the state of scientific knowledge.
  • Cybermetrics – is the quantitative research of information sources, structures and technologies on the Internet; a study of discussion groups, email communication, etc.
  • Informetrics – is focused on the information stream in networks and demonstrates on the basis of mathematical and statistical methods a variety of relations between them.
  • Scientometrics – is focused on the evaluation of efficiency of scientific-research or individual researchers by citation counts.

Continue reading

How to distribute a Java application as executable (.exe) file

One of the options how to distribute your Java application is to make the JAR file (Java archive). Every Java archive contains a manifest file which describes the rest of the files in the archive. These are typically class files, security information, etc.

The creation of Java archive is possible in the project tree in NetBeans IDE. Once you already created your project using NetBeans IDE, right-click the project name and select “Clean and Build”. Now the Java archive file will be created in the “dist” folder in the project directory. The dist folder might also contain a lib folder, which you would also need to include.

Java archives are portable across platforms which have the Java Runtime Environment (JRE) installed in it. JRE includes the language compiler, the library files and the Java Virtual Machine (JVM) in which java application executes. If you created a GUI application, double-click the file icon to launch the program, and JVM handles the creation of application’s window in an operating system environment. However, if you created a console application, it is necessary to open a command line in order to run a command similar to: java -jar archive.jar.

Continue reading