How to make hidden files in Java Program with Example
How to find hidden file with Example
You can check hidden files from Java program by using File API and isHidden()method of Java class.
How to read Environment Variables
There are two ways to get environment variable in Java, by using System properties or by using System.getEnv(). System properties provides only limited set of predefined environment variables like java.classpath, for retriving Java Classpath or java.username to get User Id which is used to run Java program etc but a more robust and platform independent way of getting environment variable in Java program on the other hand Sytem.getEnv() method provide access to all environment variables inside Java program but subject to introduce platform dependency if program relies on a particular environment variable.
Loading Java Properties Files
Java Properties files are amazing resources to add information in Java. Generally these files are used to store static information in key and value pair. Things that you do not want to hard code in your Java code goes into properties files.
Although there are multiple ways of loading properties file, I will be focusing on loading the resource bundle files from class path resources. There are advantages of adding properties files in the classpath:
How to Set Path for Java in Windows
In this Java PATH tutorial we will see what is PATH for Java, How to Set Path for Java and how to troubleshoot PATH related issues.
PATH is one of fundamental Environment variable on shell or DOS but it’s commonly associated with Java mainly because if we try to run a java program which doesn't include Java executable in PATH then we say PATH is not set for Java and we need to set path for Java. I have also seen developer getting confused over path and classpath in java.
Introduction – java.lang package
A package is a collection of predefined classes and interfaces, generally, having some common functionality (purpose). A package of Java is equivalent to a header file of C/C++. All the packages put together, that comes with JDK software, are known as Java API. The most important package of Java API is java.lang because without it no Java program with some functionality cannot be developed; it may be an application or applet. As this package is inevitable for each and every Java program you write, the package is implicitly imported if the programmer does not import himself; this automatic importing facility exist only for java.lang package and not for other packages.
How to use Memory Mapped File
Memory Mapped File in Java are special files which allows java program to read and write directly to memory which is extremely fast compare to stream based IO and allows programmer to code high performance java application.
Java Package Tutorial
Many times when we get a chance to work on a small project, one thing we intend to do is to put all java files into one single directory. It is quick, easy and harmless. However if our small project gets bigger, and the number of files is increasing, putting all these files into the same directory would be a nightmare for us. In java we can avoid this sort of problem by using Packages.
How to connect MySQL database with Example
When you start learning JDBC in Java, first program you want to execute is connect to database from Java and get some result back by executing some SELECT queries. In this Java program we will learn How to connect to MySQL database from Java program and execute query against it. I choose MySQL database because its free and and easy to install and setup. If you are using Netbeans IDE than you can connect MySQL Server directly from Netbeans, Which means in one window you could be writing Java code and other you can write SQL queries. Another advantage of using MySQL database is that it provides type 4 JDBC driver bundled in:
Simple Java Configuration Files and no XML in Sight
The last time I discussed Java configuration files it was from the point of locating them on the disk the right way. This time I want to comment on the content of configuration files. There seems to be an obsession with XML in the modern world. Some people seem to think that shoe-horning XML into their applications will somehow magically make them great. I don’t want to completely put down XML because it most certainly has its uses.
How to find IP address
Java networking API provides method to find IP address of localhost from Java program by using java.net. InetAddress class. It’s rare when you need IP address for localhost in Java program. Mostly I used Unix command to find IP address of localhost. For all practical purpose where program doesn’t need IP address but you need to troubleshoot any networking issues, Use DOS or windows command or Use Linux commands.
Love and hate for Java 8
Java 8 may be the most anticipated version of Java ever. Originally slated for release in September, Java 8 has been delayed until March of next year, supposedly to buy time to make security fixes aimed mainly at client-side Java (JavaFX/Swing).
Setting a database - MySQL
In almost every good Java program, data storage is used. Have you ever wondered how this is done? If yes, you'll be satisfied, beacause this tutorial will cover databases in Java: how to set up one, access it, modify data... A database is 100 times faster than using plain text files to manage your data, and it allows to search and order the results using SQL syntax (don't worry if it is unknown to you, it will be covered later). First of all, we need to set up your database. You need to have some basic knowledge about Java and packages to be able to follow.
The Java Game Development Tutorial
You should be already able to program in Java, although you don't have to be a expert! The tutorial will give you a very detailed introduction into the development of online games using Java. We will talk about Java Applets because everyone has a Internet browser, so everyone is able to play these games without installing the JDK!.
Java Program to compare String
Simple Example of comparing two Strings in Java. There are 4 ways you can compare two Strings in Java e.g. equals, equalsIgnoreCase, compareTo and compareToIgnoreCase. you can even write comparator to compare Strings in java.
Get the List of Files in a Directory
This Java tutorial shows how to get the list of files that are in a specific directory using Java. This tutorial will also show you how to filter the files to get only the files you are interested in.
Jikes Bytecode Toolkit
A 100%-Java class library that enables Java programs to create, read, and write binary Java class files.
A simple way to setup Java application with external configuration file
Many Java applications would deploy and run it with some kind of external configuration files. It's very typical that you would want a set of config files per environments such as DEV, QA and PROD. There many options in tackling this problem, especially in a Java app, but keeping it simple and easy to maintain would take some disciplines. Here I would layout a simple way you may use to deploy a typical Java application. The concept is simple and you can easily apply to a standalone, web, or even a JEE application.
Using the Java Native Interface with C++
There are basically two reasons why I chose to explore the Java Native Interface (JNI): Code Reusability and Performance.
Code Reusability. It may be argued that (superficially) Java is a better C++ (maybe in the way that C++ is a better C). However, the benefits of using Java at this level do not outweigh the overwhelming task of re-implementing currently tested and debugged C++ code. Given large amounts of proven C++ code, it may be more cost-effective to incorporate its functionality into a Java program, rather than to port (re-implement) the C++ functionality in Java.
Performance. Given that Java is interpreted (more or less), one would assume that compiled native code would perform much better. It may be useful to "hand-code" native methods where speed is critical.
Java Program For Doing Permutation & Combination
Java Program For Doing Permutation & Combination: Forms the unique target combinations, recursively, starting from source list that has all the possible positions (chars).
Creating an Executable jar File
In Java, it is common to combine several classes in one .jar ("java archive") file. Library classes are stored that way. Larger projects (such as the Case Study in the AP program) use jar files. You can create your own jar file combining several classes, too.