• Post Reply Bookmark Topic Watch Topic
  • New Topic

Broke java.lang  RSS feed

 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some assistance, please.

I tried to install native Eclipse on Fedora Core 4--that don't work--and now
the path to wherever java.lang is is broken. That is, I now need to import java.lang.String; to use class String.

I put rt.jar on the CLASSPATH (it wasn't), and it don't work.

Any thoughts would be appreciated.
[ September 13, 2005: Message edited by: michael clark ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea what would cause this, but let's try to figure it out. Tell me what you did to install Eclipse, exactly, what version, and what sort of configuration you did, and we'll try to make some intelligent guesses.

I'm going to move this to our IDEs forum; go on over and answer my questions there.
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of the box, FC4 comes with 'gcj' as the standard Java environment, and an Eclipse instance customized and built for that (you can even do C and C++ projects from that IDE).

To run a 'native' Eclipse, I think you would have to install Java from Sun first. Did you do that?

Guy
[ September 14, 2005: Message edited by: Guy Allard ]
 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ernest.

I tried to install the native Eclipse 3.1.0 IDE on Fedora Core 4 using Gnome.

I go to Start(the Gnome Foot icon)-->Desktop-->System Settings-->Add/Remove Applications, and there is a nice program that automatically installs .rpm's.
There is a checkbox deal that you check and press OK, and this automatically installs the 32 or so .rpm's related to Eclipse. I start Eclipse from the command-line, or from Start-->Programming-->Eclipse, and the splash screen comes up. It looks nice like it's going to work and then the whole system freezes and I need a restart, which hardly ever happens in my experience with this OS.

So, I remove Eclipse by deselecting the checkbox in Add/Remove Programs, and it uninstalls.

Now, when I try to use javac, from the /bin folder, or the other folders I have on the CLASSPATH that worked previously, I have to import java.lang.*; to use the classes.

I.e., if I try to compile:


. . . with . . .


. . . I get the following error.


[user@computer bin]# javac Hello.java
/usr/lib/java-1.5.0/String.java:1: 'class' or 'interface' expected
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
^
/usr/lib/java-1.5.0/String.java:1: unclosed character literal
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
^
/usr/lib/java-1.5.0/String.java:2: 'class' or 'interface' expected
;; If you want to create a file, visit that file with C-x C-f,
^
/usr/lib/java-1.5.0/String.java:3: 'class' or 'interface' expected
;; then enter the text in that file's own buffer.
^
/usr/lib/java-1.5.0/String.java:3: unclosed character literal
;; then enter the text in that file's own buffer.
^
Hello.java:6: cannot access String
bad class file: /usr/lib/java-1.5.0/String.java
file does not contain class String
Please remove or make sure it appears in the correct subdirectory of the classpath.
public static void main(String[] args){
^
6 errors




If I remove the comment //'s from the import statement, it compiles fine with javac.

Stranger still, now that I think about it, is that fact that the first couple errors refer to the boilerplate text that comes up in every emacs buffer when you first open a new file.

My JDK is java 5.0., and, yes, I ahd a 5.0 JDK installed previously that worked fine, if that's not obvious.

So, I did some googling, and I surmised that maybe I had to have rt.jar on the CLASSPATH. I did an . . .


. . . or to wherever the rt.jar is AND I edited the java.sh file I
keep in /etc/profile.d, which does the exact thing the abovementioned export statement does. I ran the java.sh, of course.

No difference.

I did not restart since changing and exporting the CLASSPATH, but it was my understanding that you do not need a restart for an export to take effect.

It is not a huge problem, but I am curious what the problem is.

[ September 14, 2005: Message edited by: michael clark ]
[ September 14, 2005: Message edited by: michael clark ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error messages are very clearly referring to a bogus file named /usr/lib/java-1.5.0/String.java which shouldn't be there in the first place. From the error messages, that file contains the Emacs boilerplate text. Remove the file -- and look in that directory for other files like it that also shouldn't be there. Perhaps they were left behind by the aborted install.

Actually, I don't understand why Java is looking there for system classes in the first place. Is "/usr/lib/java-1.5.0/" explicitly on your CLASSPATH? It shouldn't be.

By the way, what Guy says is true about the GNU gcj and the weird port of Eclipse to gcj. I still recommend to people that the first thing they do is remove all the Java-related GNU packages and install Sun's JDK and Eclipse.org's Eclipse. But that's up to you.
 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, there was a String.java file in /usr/lib/java-1.5.0.

I deleted it, and everything works fine now.

Thank you.
 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put my stuff in /usr/lib/java-1.5.0. I don't know if that's a weird place, but I'm the only user, so it doesn't bother anyone.

I must have created the file with the unfortunate name, String.java. It never occured to me that importing would have anything to do with .java files. The problem occurred right about the time I tried to install native Eclipse, so I thought Eclipse broke the link to java.lang.*.

I put a lot of things that probably shouldn't have been on the CLASSPATH on the CLASSPATH. I took them off including /usr/lib/java-1.5.0, but I can still compile the things in /usr/lib/java/1.5.0. Not sure what's up with that, but, I am, after all, a greenhorn.

I will try your advice on Eclipse, and, hopefully, get that going.
[ September 14, 2005: Message edited by: michael clark ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!