Two Laptop Bag*
The moose likes Beginning Java and the fly likes Arrg!  Can't compile anything! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arrg!  Can Watch "Arrg!  Can New topic
Author

Arrg! Can't compile anything!

Brian Emch
Greenhorn

Joined: Jan 22, 2006
Posts: 3
I'm using Windows XP OS SP2 and just installed jdk1.5.0_06. I just finished the "Head First Java" book (which was excellent) and had no problems with any compiling throughout the whole book on an old computer. My new (used by someone prior to me) computer will not compile anything. None of the applications I compiled will work either.

Here is what happens when I attempt to compile:

C:\javabook\gui>javac TwoButtons.java
An exception has occurred in the compiler (1.5.0_06). Please file a bug at the J
ava Developer Connection (http://java.sun.com/webapps/bugreport) after checking
the Bug Parade for duplicates. Include your program and the following diagnosti
c in your report. Thank you.
java.lang.InternalError: jzentry == 0,
jzfile = 2591288,
total = 12932,
name = C:\Program Files\Java\jdk1.5.0_06\jre\lib\rt.jar,
i = 4929,
message = invalid LOC header (bad signature)
at java.util.zip.ZipFile$3.nextElement(ZipFile.java:429)
at java.util.zip.ZipFile$3.nextElement(ZipFile.java:415)
at com.sun.tools.javac.jvm.ClassReader.openArchive(ClassReader.java:1447
)
at com.sun.tools.javac.jvm.ClassReader.list(ClassReader.java:1742)
at com.sun.tools.javac.jvm.ClassReader.listAll(ClassReader.java:1882)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1901)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1538)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:355)
at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:256)
at com.sun.tools.javac.tree.Tree$TopLevel.accept(Tree.java:382)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:221)
at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:235)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:448)
at com.sun.tools.javac.comp.Enter.main(Enter.java:433)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:403)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:67)
at com.sun.tools.javac.Main.main(Main.java:52)

When I try to run the program I get:
C:\javabook\gui>java TwoButtons
Exception in thread "main" java.lang.NoClassDefFoundError: TwoButtons

The above works fine on my old PC.

I've installed and uninstalled the JDK several times with no luck. I'm ready to start he Servlets and JSP book, but I need to get java working before I install Tomcat...

Thanks for any ideas.

Brian
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I have never seen that error before. I suggest that you do as it says and file a bug report at the given URL. Perhaps they can tell you how to fix the problem.

Also, you can't expect to run a program unless you have a compiled .class file. During development, you typically get this file by running javac to compile your .java files. Perhaps you should compile a program on your old machine and copy the .class file to the new one to see if you can run it. Of course, this doesn't do a lot of good since you need to be able to compile programs on your new machine. Sorry that I can't be of much help.

Out of curiosity, did you format the hard drive and reinstall an OS on this new machine or are you using it "as is"?

Layne


Java API Documentation
The Java Tutorial
Brian Emch
Greenhorn

Joined: Jan 22, 2006
Posts: 3
I have the .class for the application I am trying to run, but get the error that I posted.

This is a "hand-me-down" machine that is a bit better than my previous one, so no new OS install.

Thanks, I'll post this to the sun bug report site. I just thought maybe someone might have run across this before.
Dave Tuttle
Ranch Hand

Joined: Jan 18, 2006
Posts: 34
I would do a clean install of windows. Often that's the only way to fix mysterious system errors.
--Dave
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I suggest an new OS install as well. If I bought a hand-me-down machine that's the first thing I would do, mostly because I don't want all their applications and data taking up space that I can use for my own apps and data.

Layne
Brian Emch
Greenhorn

Joined: Jan 22, 2006
Posts: 3
I'm going to wipe the hard drive this weekend and re-install everyting.

I did get it working by copying the jdk directory from a friends machine. The install will not ever work, but a straight copy of the environment worked OK. Strange.

Thanks for the help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Arrg! Can't compile anything!
 
Similar Threads
invalid LOC header - How to overcome this Exception?
java.lang.InternalError - invalid LOC header
Failure executing javac, but could not parse the error issues
java.lang.OutOfMemoryError / xerces problem
EJB Complie failure..