aspose file tools*
The moose likes Beginning Java and the fly likes Compiling in Eclipse 3.6.0 but failing with Javac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiling in Eclipse 3.6.0 but failing with Javac" Watch "Compiling in Eclipse 3.6.0 but failing with Javac" New topic
Author

Compiling in Eclipse 3.6.0 but failing with Javac

Amad Sin
Greenhorn

Joined: Nov 14, 2010
Posts: 2
Hiii,

After I completed my project with Eclipse 3.6 and everything is running ok on my machine (java version "1.6.0_22"). I moved my files to my school server using FileZilla. Then, I logged in to that server using Putty. After that, I tried to compile my files with javac and it failed to compile there!! (java version "1.4.2_13")

I would appreciate any help in resolving this issue!

Here is an example of compiling one of the files:

javac Prefix.java

Prefix.java:10: <identifier> expected
private ArrayList<String> words;
^
Prefix.java:16: <identifier> expected
public Prefix(ArrayList<String> words) {
^
Prefix.java:38: illegal character: \64
@Override
^
Prefix.java:54: illegal character: \64
@Override
^
Prefix.java:63: illegal character: \64
@Override
^
Prefix.java:72: ')' expected

^
6 errors

Thanks,

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19073
    
  40


Generics and annotations were features that were added with Java 5. It isn't available with Java 1.4.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Amad Sin
Greenhorn

Joined: Nov 14, 2010
Posts: 2
Henry, thanks for your reply!

but this is the first time i got such errors. I previously compiled many files which includes generics on the same server with javac! including ArrayList<Type> and LinkedList<Type>!!

Now, I cannot even compile my previous files which i did not have issues with!

do you think i have a problem with my java version on my account on the linux server?! I recently installed tomcat server on my account there!

What do you propose at a soultion to this?

Thanks,
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

I would double check the java version. At least you need Java 5 maybe Java 6.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19073
    
  40

Amad Sin wrote:but this is the first time i got such errors. I previously compiled many files which includes generics on the same server with javac! including ArrayList<Type> and LinkedList<Type>!!

Now, I cannot even compile my previous files which i did not have issues with!


We don't have any information about why it used to compile on the system and doesn't do so now -- all we can tell you is that the version of Java currently installed on that system doesn't support the features that you want.

Henry
William Kim
Greenhorn

Joined: Feb 05, 2011
Posts: 2
Thank you all for the kind questions ans answers. I joined the forum to inform my fix.

[1] Go to Project->properties->Java Compiler
Select 1.6 but this is not enough. Momentrarily when I saw to the link to installed JREs, I changed to jrockit_160_17_R28.0.0-679 as below.
When you can't see the link to JREs change. Simply do the following.

[2] Go to windows->preferences->java->installed JREs
Selected C:\Oracle\Middleware\jrockit_160_17_R28.0.0-679 (instead of C:\Program Files\Java\jre1.6.0_07, though not sure)

[3] Go to Project->properties->resource
UTF-8 for Text file encoding (maybe not critical)
Windows for New text file inline delimiter (maybe not critical)

Good day every day.
William
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Welcome to the Ranch William Kim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling in Eclipse 3.6.0 but failing with Javac