Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Compiling in Eclipse 3.6.0 but failing with Javac  RSS feed

 
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,

 
author
Posts: 23832
140
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,
 
Bartender
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
Posts: 23832
140
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
 
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
 
Marshal
Posts: 64496
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch William Kim
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!