This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

What are some of the differences between developing

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ...
 
Marshal
Posts: 76120
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
     
    Ranch Hand
    Posts: 311
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 201
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thanks guys
     
    Java Cowboy
    Posts: 16084
    88
    Android Scala IntelliJ IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic