![]() |
![]() |
|||
|
|
||||
| Català | Castellano | |||
|
|
|
|
JavaLast modified: 14-06-2002
1.- Installing JDK (Java Development Kit)
1.- Installing JDK (Java Development Kit) R: JDK (Java Development Kit) is the package of programs for developing and running Java applications. It offers the possibility of running them in the Internet browser or independently, depending on the type of application you wish to create. R: JDK is completely free, and the latest version is available for download at the
Currently, the Linux PC network is loading JDK 1.1.7, and Windows is loading JDK 1.1.8 and JDK 1.2.2. With respect to the IP practicals, the newer versions (1.2.2) are compatible with Versions 1.1.7 and 1.1.8. 1.3 How do I install JDK on my computer? R: Windows installation. SET PATH=%PATH%;[JDK_folder]\BIN where [JDK_folder] is the folder where JDK is installed. For example, if C:\JDK is the folder you used to install the program, AUTOEXEC.BAT should include the line: SET PATH=%PATH%;C:\JDK\BIN. The documentation is independent from the program. It need not be in the same folder as JDK. R: Linux installation R: You can edit Java code in any text editor that can output text files. The files must have the extension .java. You can do this by simply renaming the file as file_name.java, or by using the "save as" option that is available in most editors. 2.2 How do I compile Java code? R: In order to compile Java code you need to install JDK and modify autoexec.bat, as explained in point 1. Once you have all necessary files, you need only type the Javac command along with the file name. javac [file_name].java 2.3 how do I run Java applications? R: This depends on the type of application you are writing. java [file_name] If the application is an applet, there is a JDK tool for viewing applets. This tool is actually a browser, but it is so basic that it only understands the tag <APPLET ... </APPLET. The tool is called appletviewer. The parameter you give it is not the Java applet itself, but a web page that contains an applet somewhere in the code. appletviewer [file_name].html 2.4 How do I run and work with JDK at the School in Windows? R: Depending on the version you want to work with, type: INIJDK x where x is 1 for Version 1.1.7; or x is 3 if you want to use Version 1.2.2. R: Java is case-sensitive. Although useful, this is the source of many head-aches when compiling code, since it is quite easy to overlook the fact that a variable is typed in two different cases. If your code won't compile, check that all of the variables are written correctly. 3.2 I'm trying to run Javac or Java and it doesn't work. How do I solve this problem? R: This is because you have not correctly installed JDK, or you have forgotten to modify the JDK path (in autoexec.bat in Windows, and the environment variables in Linux) 3.3 The compiler gives this message when compiling: "Note: Marquesina.java uses a deprecated API". Is there a solution to this? R: This message is not an error. The compiler is informing you that there is a function in the code that belongs to previous versions of JDK, and that the program will still work, although there are better or faster ways of carrying out this particular task. There is the danger that these functions will disappear in future versions, and that the code won't work with new versions of the virtual machine. 3.4 The compiler says I have not defined a class, but I have finished writing all the code. What am I doing wrong? R: This can happen when a class is inherited. There are classes that define methods that are not implemented within the class, but need implementing in the classes that inherit them. These methods must be defined even if they are not needed. | |||||||||||||||||
| Copyright © Facultat d'Informàtica de Barcelona - webmaster |