I am writing java code. which will work on windows and linux. some code are depend on platform base how can i check my application running on which platform ?
Well to get OS information you could have something like:
final String nameOS = "os.name";
final String versionOS = "os.version";
final String architectureOS = "os.arch";
System.out.println("\n The information about OS");
System.out.println("\nName of the OS: " +
System.getProperty(nameOS));
System.out.println("Version of the OS: " +
System.getProperty(versionOS));
System.out.println("Architecture of THe OS: " +
System.getProperty(architectureOS));
But your code MUST be platform independent. If you cannot achieve this by using java...well then probably you haven't built your application the right way.
According to wikipedia:
http://en.wikipedia.org/wiki/Java_%28software_platform%29
An edition of the Java platform is the name for a bundle of related programs from Sun that allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine (called a virtual machine) and a compiler with a set of libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them.