This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
HI, Does anybody have any idea why can't I compile my programs using swing on Visual J++ 6.0? It just doesn't recognize the "import javax.swing.*;", it says that there is no such package available. Second question: Why sometimes the compiler asks me me to put two classes into different files? Is it only they are public classes? Any tips to get me out of my darkness would be appreciated. Cheers, Flavio
Flavio, I think Thomas answered your question about VJ++, so I will attempt to answer your other question. Java requires only one top level public class per source code file. Personally, the only time I would even put more than one class in a source code file would be with inner classes. Java also requires that the name of the source code file be the same as the top level public class inside it. So this is OK...
But you cannot do this... // Stored in A.java
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I recieved this tip from someone else hope this helps Microsoft Visual J++ is a Java IDE for editing, compiling, and debugging Java source code. It also provides GUI editing tools that generate code for you you. Visual J++ added some extensions to the pure Java language that you can easily disable. The latest version of Visual J++ is 6.0. It supports JDK 1.1. In order to use JDK 1.2, JDK 1.3, or beyond you must follow the procedure below: Modify the CLASSPATH in the registry. Run RegEdit.exe and locate the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM and modify the CLASSPATH string to include the rt.jar file from you JDK distribution. For example: c:\Program Files\JavaSoft\JRE\1.3\lib\rt.jar needs to be added to the end of the CLASSPATH string, and don't forget the semi-colon separating each entry in the string. Also note the "." at the end of the CLASSPATH string.