Are jar files platform independent




















Of course, this means that under the hood the run time environment does make use of platform-specific features, so you need a different JRE for each platform. The JVM itself i. However specific versions of the JVM are needed for each underlying platform to take account of different native instruction codes and machine capabilities so you can't run a Linux JVM on Windows and Vice Versa.

Overall, Java is probably about as close to true platform independence as you can get, but as you can see there is still quite a bit of platform-specific work done under the hood. But you should still test it!! You're right, platform independence means that the same program works on any platform operating system without needing any modification.

In the case of Java the application runs in a Java Virtual Machine which itself isn't platform independent. This has to be the interface between the actual machine operating system and the Java code you've written.

In the case of videos, images etc. In my opinion, this is also a kind of platform independence. And algorithms can be said to be platform independent in this way.

You are right in terms of true platform independence for file types. But the term platform independence is not usually applied to files. JAVA is an object oriented platform independant programming language.

The javac compiler compiles source code and produces Byte code language universal language. This language is not understandable by any operating system, it has to be processed first, and this is where a special executable program JVM enters the scene. An interpreter of the JVM reads the bytecode line by line and converts the byte code instructions into machine-specific understandable language ultimately binary code.

So, the byte code is platform independent but the interpreted code is machine-specific and will execute on the environment the JVM is installed on. Also, the Java language by design has requirements on the filesystem resulting in short class names if the system is using a FAT16 partition:. As comparison, C has very little runtime requirements and can therefore offer higher portability.

It is still possible to backport smaller C programs to really low-end devices. Sign up to join this community. Preserving Time Instants. Using Character Sets and Unicode. Using Query Attributes. Connecting Using Unix Domain Sockets. Connecting Using Named Pipes. Connecting Using Various Authentication Methods. Connecting Using Kerberos. Client Session State Tracker. Multi-Host Connections. Advanced Load-balancing and Failover Configuration.

Schema Validation. Using JdbcTemplate. Connection Pooling with Spring. Table of Contents. Improve Article. Save Article. Like Article. The meaning of platform-independent is that the java compiled code byte code can run on all operating systems. A program is written in a language that is a human-readable language.

It may contain words, phrases, etc which the machine does not understand. For the source code to be understood by the machine, it needs to be in a language understood by machines, typically a machine-level language. So, here comes the role of a compiler. The compiler converts the high-level language human language into a format understood by the machines.

In this jar I have integration with Cognos system and we are doing some file writing and few database operations using Oracle database. I feel the file writing and db operations should run as they are working now.

But still I am not sure of Fie. I have got a task to check if the jar will run Linux system or not. Is there a way to check if the Jar file is platform independent? The only way to be sure is to install it on a Linux system, and do a full test of all functionality. If that is too onerous, at least test of all functionality that could conceivably be platform dependent.

For the record, there are lots of things that could make your code platform dependent, including:. Check it on linux or mac but you need to check few platform dependent things such as Using correct path separator for file operations, line breaks. You can use java.

How are we doing? Please help us improve Stack Overflow. Take our short survey.



0コメント

  • 1000 / 1000