Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

jagatuba

Okay since .class files use the JRE to run, this theoretically makes them platform-independent. Since, the class file contains the byte-code to that the JRE uses to run it, it should run whether that JRE resides on a Windows machine, a Linux box, or on a Mac. I wrote a Java program and the class file executes perfectly on my Windows laptop, but will not work on my Mac. When I try to run it in OS X I get the following error:

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. jagatuba
    Best Response
    You've already chosen the best response.
    Medals 0

    Exception in thread "main" java.lang.NoClassDefFoundError: CalMortCalc$Interact at CalMortCalc.<init>(CalMortCalc.java:384) at CalMortCalc.main(CalMortCalc.java:522) Caused by: java.lang.ClassNotFoundException: CalMortCalc$Interact at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 2 more

    • 2 years ago
  2. jayanth.log
    Best Response
    You've already chosen the best response.
    Medals 0

    no dude the .class file is common to all the platforms there might be any warning in your code please note it.

    • 2 years ago
  3. rsmith6559
    Best Response
    You've already chosen the best response.
    Medals 0

    Where is CalMortCalc$Interact.class located when you run it on OSX? Do you need to adjust/declare a CLASSPATH variable?

    • 2 years ago
  4. jagatuba
    Best Response
    You've already chosen the best response.
    Medals 0

    I figured it out. I had forgotten that I had created and implemented a class called interact within the program. At compile time java automatically creates that class file (CalMortCalc$Interact). Both of those files must be present for the program to execute, but I only copied the CalMortCalc.class, not both. I brought over CalMortCalc$Interact.class and the program works fine. Sometimes it is the simplest things that leave you puzzled. Turns out all I really needed was a little sleep. lol

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.