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.

How do I use “javac” from the JDK to compile .java files?

files javac JDK
0
Posted

How do I use “javac” from the JDK to compile .java files?

0

If you simply type “javac” and return at your command line (Win32 and Solaris), javac should dump a list of options that it understands. Typically you use javac like “javac MyClass.java”. There are a few important things to note about javac: • It is case-sensitive, even if your platform’s OS is not. “javac myclass.java” is NOT the same as “javac MyClass.java”. You will get weird errors such as “Class MyClass must be defined in a file called MyClass.java” if you do not provide the correct filename case. • It doesn’t like whitespace in filenames. • You must have set up your CLASSPATH correctly for it to work. Specifically, javac needs to be able to find the core JDK classes which the JDK typically provides under jdk/classes/classes.zip. It also needs to be able to find the class you wish to compile. • It outputs compiled classes to your CLASSPATH. So if you compile a class under JNC.mySubPackage, the compiled .class file will appear under CLASSPATH/JNC/mySubPackage. If you have any quest

Related Questions

What is your question?

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