Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2006

Tip: Looking for answers? Try searching our database.

Java Compilation Problem

Thread view: 
jerry - 06 Feb 2006 21:52 GMT
Because of a problem, I had to format my hard drive, and reinstall MS XP. I
downloaded j2sdk-1_4_2_10-windows-i586-p, and tried to compile my java
program. I got the following:

C:\j2sdk1.4.2_10\bin>javac ira.java
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

Any suggestions?
Monique Y. Mudama - 06 Feb 2006 22:05 GMT
> Because of a problem, I had to format my hard drive, and reinstall
> MS XP. I downloaded j2sdk-1_4_2_10-windows-i586-p, and tried to
[quoted text clipped - 5 lines]
>
> Any suggestions?

What's your classpath?

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Roedy Green - 06 Feb 2006 23:08 GMT
>C:\j2sdk1.4.2_10\bin>javac ira.java
>Error occurred during initialization of VM
>java/lang/NoClassDefFoundError: java/lang/Object

that's an odd one. NoClassDefFoundError is normally a run time
problem. javac is having trouble finding its classes.  I suspect it is
because you have two different JDKs installed and somehow it is
getting parts of the old one mixed in with the new.  I suggest
uninstalling all JDKs, cleaning the registry, getting rid of java.exes
anywhere and starting over.

See http://mindprod.com/jgloss/jdk.html#TESTING for details.

http://mindprod.com/projects/jvmmanager.html

we need a sanity checker and restorer for Java if it is to be
successful with the general public.

See http://mindprod.com/projects.html#SANITYCHECKER
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

jerry - 06 Feb 2006 23:35 GMT
I went to add/remove programs, and the only java I found was the one I was
running. Note: when I did my compilation, I put my .java file in the same
directory as the javac command, so for my first test I wouldn't have any
path issues.

> >C:\j2sdk1.4.2_10\bin>javac ira.java
> >Error occurred during initialization of VM
[quoted text clipped - 18 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.
Bjorn Abelli - 07 Feb 2006 10:48 GMT
"jerry" wrote...
> "Roedy Green" wrote...
>>
[quoted text clipped - 10 lines]
>>
>> See http://mindprod.com/jgloss/jdk.html#TESTING for details.

I would rather believe that the single instance of the jdk is corrupt, as
the OP has reformatted the harddrive and made a clean install.

> I went to add/remove programs, and the only java I found was the one I was
> running. Note: when I did my compilation, I put my .java file in the same
> directory as the javac command, so for my first test I wouldn't have any
> path issues.

The class libraries are located elsewhere, so it could still be some sort of
classpath problem.

However, as it occurs already at initialization of the VM, that infers that
the registry settings for Java are corrupt, or that the class libraries not
are present. In any case, that would make me believe that the installation
of the JDK has been interrupted somehow, and it needs to be completely
reinstalled.

// Bjorn A
Roedy Green - 07 Feb 2006 11:34 GMT
On 7 Feb 2006 11:48:50 +0100, "Bjorn Abelli"
<bjorn_abelli@DoNotSpam.hotmail.com> wrote, quoted or indirectly
quoted someone who said :

>The class libraries are located elsewhere, so it could still be some sort of
>classpath problem.

Javac gets its own class files without using the classpath.  The error
message sounded like it was having trouble finding its OWN classes,
not the programmer's.  Things have to be pretty screwed up for that to
happen.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Bjorn Abelli - 07 Feb 2006 12:34 GMT
"Roedy Green" wrote...

>> The class libraries are located elsewhere, so it could still be some
>> sort of classpath problem.
[quoted text clipped - 3 lines]
> not the programmer's.  Things have to be pretty screwed up for that to
> happen.

And that is what I said, that Java can't find the path to the classes, hence
a possible "classpath" problem.

The OP was wondering why it didn't work despite the fact that he ran it from
the bin-directory.

I agree that I could have been more specific in writing out what I meant
with "sort of" classpath problem, as I *didn't* mean the environment
variable "CLASSPATH" or the switch -classpath, but just that; the path to
the classes.

Out of courtesy, you should have included the part of my answer that it most
likely means that the JDK-installation is corrupt.

// Bjorn A
Roedy Green - 07 Feb 2006 12:42 GMT
On 7 Feb 2006 13:34:21 +0100, "Bjorn Abelli"
<bjorn_abelli@DoNotSpam.hotmail.com> wrote, quoted or indirectly
quoted someone who said :

>Out of courtesy, you should have included the part of my answer that it most
>likely means that the JDK-installation is corrupt.

Sorry no, I won't.  I only include enough of a previous post to let
mine make sense, just it indicate the general topic, not to
recapitulate.   I hate it when people quote stuff I have already read
and you have to scroll down four pages to read one new line.

If people can't remember what was said before, let them get a decent
newsreader that lets them look.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

jerry - 06 Feb 2006 23:38 GMT
Another comment. I just formatted my hard drive, and reinstalled MS, and
java. So I don't so how othere pieces of java would be out there.

> >C:\j2sdk1.4.2_10\bin>javac ira.java
> >Error occurred during initialization of VM
[quoted text clipped - 18 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 07 Feb 2006 03:51 GMT
>Another comment. I just formatted my hard drive, and reinstalled MS, and
>java. So I don't so how othere pieces of java would be out there.


check your registry for sanity. See
http://mindprod.com/jgloss/registry.html
for what it should look like.  

You might also have a stray old copy of java.exe screwing things up.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Noodles Jefferson - 07 Feb 2006 05:22 GMT
> Because of a problem, I had to format my hard drive, and reinstall MS XP. I
> downloaded j2sdk-1_4_2_10-windows-i586-p, and tried to compile my java
[quoted text clipped - 5 lines]
>
> Any suggestions?

Uninstall/Reinstall the jvm. It's hosed.

Signature

Noodles Jefferson
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "Jellyroll" -- Blue Murder

"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum,
a pocketknife, and a smile."

-- Robert Redford "Spy Game"



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.