Java platform independence check

I created a jar that runs on Windows. In this bank, I have integration with the Cognos system, and we record several files and several database operations using the Oracle database.

I have a task to check if jar will work on Linux system or not.

Is there any way to check if the Jar file is platform independent?

I feel that writing files and db operations should be done as they work. But still I'm not sure about Fie.

+4
source share
2 answers

I have a task to check if jar will run Linux system or not. Is there a way to check if the Jar file is platform independent?

just to be sure , install it on a Linux system and perform a full test of all the functions. (If this is too burdensome, at least check out all the functionality that may be platform dependent.)


There are many things to write about that can affect your code platform, including:

  • hard wiring a newline terminator into your code,
  • hard wired paths to your code,
  • Assuming the syntax of the Windows (or Linux) file syntax of the file when assembling the paths,
  • what to do with Windows file locking and other types of file system behavior on the platform,
  • names of external hard wiring commands in your code,
  • using your own code libraries,
  • make assumptions about I / O coding (for example, assuming UTF-8 or something else is used by default),
  • strange things in Swing GUI visualization and (sometimes) behavior,
  • and possibly others that I did not think about.

The only way to make sure that you haven’t missed anything is to check, test, test

+1
source

Check this out on linux or mac, but you need to check out some platform-specific things, such as using the correct path separator for file operations, line breaks

You can use java.io.File.separatorChar or System.getProperty("path.separator"); for the path separator and System.getProperty("line.separator"); for line breaks.

+1
source

Source: https://habr.com/ru/post/1447665/


All Articles