aspose file tools *
The moose likes Java in General and the fly likes convert java files from windows to linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "convert java files from windows to linux" Watch "convert java files from windows to linux" New topic
Author

convert java files from windows to linux

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 251
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

Joined: Mar 22, 2005
Posts: 42952
    
  73
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

Joined: Oct 02, 2003
Posts: 11500
    
  16

your .class files can be moved over to your linux box and should run as is.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 251
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

Joined: Sep 29, 2008
Posts: 12617

dos2unix, or in any (reasonable) editor.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40079
    
  28
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

Joined: Sep 29, 2008
Posts: 12617

(I think the OP was referring to source files saved in a non-useful way.)
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 251
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert java files from windows to linux