File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 239
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
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
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?


Ping & DNS - updated with new look and Ping home screen widget
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10911
    
  12

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: 239
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: 36478
    
  16
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: 239
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
 
Similar Threads
Install Issues - Fedora Core 1
technical doubt
Linux networking
java Threading mapped with LINUX / WINDOWS OS ?
How convert Word Doc to HTML/WML/XML?