File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert java files from windows to linux

 
albert kao
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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: 252
  • 0
  • Mark post as helpful
  • send pies
  • 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).
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dos2unix, or in any (reasonable) editor.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • 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: 252
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic