views:

102

answers:

4

are there any things that once can do ignorantly that can prevent a java web application from being cross platform? (windows/linux/mac)

Tools I am planning to use are java/spring framework/hibernate

+12  A: 
  • Hard-coding file separators/paths.
  • Using native libraries.
  • Using Runtime.exec()
  • Using sun.* classes (this may cause portability issues with non-Sun JVMs).
Dan Dyer
+1 for the hard-coding of file separators -- those are brain-dead killers on a lot of apps that have no reason otherwise not to work cross-platform.
delfuego
Using `sun.*` (and most `com.sun.*`) classes may well cause portability between update releases. Don't do it!
Tom Hawtin - tackline
how would you not hard code seperators? using a .xml config file or?
mrblah
@mrblah: try java.io.File.separator
karoberts
+6  A: 

not honoring case-sensitivity in filesystem

peter p
+5  A: 

In addition to what Dan Dyer said:

  • calling executables by a fixed path or of a fixed name
  • assuming a certain shell command syntax will work properly (eg 2>&1 or something)
  • deleting or renaming a file that some other process (or the same one!) might have open
  • Making assumptions about the working directory (eg using relative paths to load resouces from the file system)
Dan
+6  A: 

Using system default character encoding for input/output when inappropriate

axtavt