• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

convert java files from windows to linux

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had developed my java programs with Spring framework, Eclipse on Windows. How to convert to linux (ubuntu)?
Do I write a script with dos2unix?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "convert"? Java source code compiles cross-platforms, and class files run cross-platform. Or are you referring to the line endings in the files?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your .class files can be moved over to your linux box and should run as is.

 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:What do you mean by "convert"? Java source code compiles cross-platforms, and class files run cross-platform. Or are you referring to the line endings in the files?



I am referring to the line endings in the files (java, eclipse projects, etc).
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dos2unix, or in any (reasonable) editor.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You ought to avoid using \n or \r unless you specifically want those characters. Using the %n tag after printf or format, or using println, ensure that the JVM uses the correct line end combination for the operating system. More details about %n in the Formatter class.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(I think the OP was referring to source files saved in a non-useful way.)
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

albert kao wrote:I had developed my java programs with Spring framework, Eclipse on Windows. How to convert to linux (ubuntu)?
Do I write a script with dos2unix?



Another person told me to do this in Eclipse:
Select the project(s) and then File > Convert Line Delimiters To > Unix
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic