wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes What are some of the differences between developing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What are some of the differences between developing" Watch "What are some of the differences between developing" New topic
Author

What are some of the differences between developing

Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
in Windows and developing in Unix?
I've only developed in Windows environment, but I notice some jobs want people with Unix experience. Is there a big difference?
Felix Black
Greenhorn

Joined: May 15, 2007
Posts: 8
difference between windows and UNIX ?? .... yes ... they are totally different environments .... how that fact effects java programming i dont know.

Corect me on this, but java is totally portable due to its bytecode... so actually writing code on a UNIX, LINUX.. or any other platfomr shouldnt be that different.

Actualyl using the platform is another thing entirley ...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Java is not quite totally portable. There are difference between Java programming in Linux and Windows. I know about 4.
  • Different path separator, ; on DOS and Windows, : on Linux Unix and Mac.
  • Different line end, 0xd 0xa (\r\n) on DOS and Windows, 0xa (\n) on Linux, not sure on Mac.
  • Different file separator \ on DOS and Windows, / on Mac Unix and Linux
  • Different end-of-file, something with ctrl-Z on DOS and Windows, something with ctrl-D on Mac Unix and Linux.
  • There is a fuller list in some books [eg I think in: David Flanagan, Java in a Nutshell 5/e Sebastopol: O'Reilly (2005), maybe chapter 7]. You can get a list of different properties with a method called getProperties or similar in the System class.
    Sol Mayer-Orn
    Ranch Hand

    Joined: Nov 13, 2002
    Posts: 311
    1)
    Personally, i've had some rare cases when *threading* was a headache.
    There *are* well-known recommendations for correct, platform-independent threading programming in java (such as the famous "don't make too strong assumptions about Thread.setPriority").
    However, I was once involved in an application which used some 3rd partly library ("black box"), which worked on windows and crashed on Linux, opening way too many threads, which showed up as 'processes' , surprising Linux ignorats such as myself... calling over a Linux expert saved us some time, even for telling threads from processes and such like.

    2)
    Some employers may *also* want you to just be comfortable with the environment, regardless of java programming.

    E.g. suppose the application is finished, you just need to deply it to the target unix machine, executed, and possibly handle crashes and debugging.
    So you find yourself: writing some related shell scripts, defining some environment variables, zipping/unzipping resources, losing some files and having to use a 'find' command to look for them, needing to edit some configuration files using VI editor, then managing to freeze the entire application and having to kill the process... you get the idea.
    Jay Dilla
    Ranch Hand

    Joined: Aug 12, 2004
    Posts: 201
    thanks guys
    Jesper de Jong
    Java Cowboy
    Saloon Keeper

    Joined: Aug 16, 2005
    Posts: 14114
        
      16

    Originally posted by Campbell Ritchie:
    Java is not quite totally portable. There are difference between Java programming in Linux and Windows. I know about 4.
  • Different path separator, ; on DOS and Windows, : on Linux Unix and Mac.
  • Different line end, 0xd 0xa (\r\n) on DOS and Windows, 0xa (\n) on Linux, not sure on Mac.
  • Different file separator \ on DOS and Windows, / on Mac Unix and Linux
  • Different end-of-file, something with ctrl-Z on DOS and Windows, something with ctrl-D on Mac Unix and Linux.
  • There is a fuller list in some books [eg I think in: David Flanagan, Java in a Nutshell 5/e Sebastopol: O'Reilly (2005), maybe chapter 7]. You can get a list of different properties with a method called getProperties or similar in the System class.

    You should not hard-code path and file separators, end-of-line and end-of-file characters in your application, and you don't need to with Java.

  • Use java.io.File.pathSeparator instead of hard-coding ";" or ":" in paths.
  • Use java.io.File.separator instead of hard-coding "/" or "\" in file names.
  • Use System.getProperty("line.separator") to get the line separator of the OS your program is running on.


  • If you do that and watch out for other platform-specific things, your Java application will be fully "write once, run anywhere" - it will run on Windows as well as Unix without modification.


    Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
    Scala Notes - My blog about Scala
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: What are some of the differences between developing