Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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:

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

Exception in thread "main" java.lang.NoClassDefFoundError: CalMortCalc$Interact at CalMortCalc.(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
no dude the .class file is common to all the platforms there might be any warning in your code please note it.
Where is CalMortCalc$Interact.class located when you run it on OSX? Do you need to adjust/declare a CLASSPATH variable?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

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

Not the answer you are looking for?

Search for more explanations.

Ask your own question