Topics Search

How to make hidden files in Java Program with Example

How to make hidden files in Java Program with Example
Views: 20
we will see how to hide file in Java or make hidden file in Java. As we said File API in Java doesn’t provide any method to make a file hidden in Java but still you can apply some quick tricks to hide files from Java program. Like in Unix environment any file whose names begin with dot (.) is hidden so you can name your file starting with dot (.) and your File will be hidden in Linux or Unix Environment.
Sponsored Links:

More topics

 

How to find hidden file with Example

Preview
You can check hidden files from Java program by using File API and isHidden()method of Java class.
 

How to Run a JAR file from Command Prompt

Preview
So you got a JAR file which contains your favorite Java game and you are wondering how to run Java program from JAR file? Or you may be simply trying your hand after running Java program from the command prompt and Eclipse IDE. Anyway, it's good to know How to execute Java program from JAR file, as JAR file is a most popular way of shipping Java programs. JAR file usually contains all source and resource in the form of class files, images, sound files etc.
 

Java File I/O Basics

Preview
Java 7 introduced the java.nio.file package to provide comprehensive support for file I/O. Besides a lot of other functionality this package includes the Files class (if you already use this class you can stop reading here). Files contains a lot of static methods that can be used to accomplish common tasks when working with files. Unfortunately it looks to me that still a lot of newer (Java 7+) code is written using old (pre Java 7) ways of working with files. This does not have to be bad, but it can make things more complex than needed.
 

How to Use Locks in Multi-threaded Java Program

Preview
Many Java programmers confused themselves like hell while writing multi-threaded Java programs e.g. where to synchronized? Which Lock to use? What Lock to use etc. I often receive request to explain about how to use Locks in Java, so I thought to write a simple Java program, which is multi-threaded and uses rather new Lock interface. Remember Lock is your tool to guard shared resource which can be anything e.g. database, File system, a Prime number Generator or a Message processor. Before using Locks in Java program...
 

How to read Environment Variables

Preview
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

Preview
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:
 

Introduction – java.lang package

Preview
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

Preview
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.
 

How to Set Path for Java in Windows

Preview
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.
 

How and when to use Exceptions

Preview
Exceptions in Java are an important instrument to signal abnormal (or exceptional) conditions in the program flow which may prevent it to make a further progress. By nature, those exceptional conditions may be fatal (the program is not able to function anymore and should be terminated) or recoverable (the program may continue to run though some functionality may not be available). In this section of the tutorial we are going to walk through the typical scenario of using exceptions in Java, discuss the checked and unchecked exceptions, and touch some corner cases and useful idioms.