Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What do I have to do to compile and run a Java program?

0
Posted

What do I have to do to compile and run a Java program?

0

Your 1.4 program is almost guaranteed to be compatible with 1.5. There are a couple of compatibility issues, but almost certainly they won’t come up. First thing, make sure you’re using the right commands. To compile a class: “javac First.java” To execute a class: “java First” Make sure you don’t add “.class” onto the end. And be aware that if your class has a package associated with it, it’ll end up being kept in a subdirectory tree that looks like its package. Okay, your next problem, paths. I’ve got a good feeling that your javac and your java are from different versions. I bet you have a Java runtime in your path somewhere ahead of your java sdk path. That way you’re compiling it as a 1.4 program, but trying to execute it as a 1.5 program. Or the reverse. Query both javac and java for their version numbers and see if they match up. Make sure your SDK’s bin directory not only appears in the PATH, but appears before anything else. You could also try calling your compiler and interpre

Related Questions

Thanksgiving questions

*Sadly, we had to bring back ads too. Hopefully more targeted.