Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling in Eclipse 3.6.0 but failing with Javac

 
Amad Sin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20894
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Henry
 
Amad Sin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would double check the java version. At least you need Java 5 maybe Java 6.
 
Henry Wong
author
Marshal
Pie
Posts: 20894
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch William Kim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic