wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Need hep regarding Compiling a Java file in 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need hep regarding Compiling a Java file in 1.4 " Watch "Need hep regarding Compiling a Java file in 1.4 " New topic
Author

Need hep regarding Compiling a Java file in 1.4

C Teja
Greenhorn

Joined: Feb 28, 2013
Posts: 2
Hi All,
I am currently facing a tricky situation where in i have to compile a Java file whose package name have "enums" in it . (It was created using Java 1.4) . Currently the server on which the code is present have Java 1.5 . I need to compile the file on the server . Can any 1 assist me with it .

Thanks In Advance ....



K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2627
    
    9

Welcome to the Ranch.

You can use the -source and -target flags of the javac command to specify v1.4 or v1.5. Since the original was created with 1.4, and compiled using 1.5 the compiler may warn you about generics depending on how the code is written.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
C Teja wrote:whose package name have "enums" in it

enums or enum ?


Joanne
C Teja
Greenhorn

Joined: Feb 28, 2013
Posts: 2
Joanne Neal wrote:
C Teja wrote:whose package name have "enums" in it

enums or enum ?

Appologies I mean enum
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
C Teja wrote:
Appologies I mean enum

In that case, unless K. Tsang's suggestion of using the -source flag works (and I suspect it won't), I think your only option is to change the package name. enum is a reserved word in Java 1.5
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8427
    
  23

Joanne Neal wrote:In that case, unless K. Tsang's suggestion of using the -source flag works (and I suspect it won't), I think your only option is to change the package name. enum is a reserved word in Java 1.5

@C Teja: And to my mind, the whole process of compiling a bunch of Java written in a long-dead version (since October 2008, according to this) into another long-dead version (R.I.P. November 2009), strikes me as a complete WOBTAM.

Far better to implement a game of "spot the management braincell", I reckon.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need hep regarding Compiling a Java file in 1.4