Java diary

xiaoxiao2021-03-06  110

I have a cold two days. I haven't seen Core Java.

Another reason is to apply for a 9CBS blog. It has been familiar with the time for more than half a day. Now the interface is slightly better.

See your own results. How to say it is happy. And because this blog made me gain a lot! 9cbs. Be sure to go to see. Ha ha ~ Every time there will be harvest!

I saw the top three chapters of Core Java today. It feels good. It is much better than C , and it is impressed that Java is very human. It can be accepted. Complete acceptance. At least I am like this. After all, it is still a rookie who read a few books. Just say it here .. Hehe

Java. The beginning of learning should be relatively simple. At least I am like this.

Install JDK. Beginners should use this!

Http://java.sun.com. You can do yourself for yourself. If you don't ... read English. Then you will go back to see English. English is too important to programmers. JDK is the development environment of Java. The function is not very powerful. But enough! I intend to be familiar with Java and use jbuildr.

Run the command after installation: Java -Version OK will display your Java version

Install JVM, go:

Http://www.java.com/en/index.jsp Auto Update can be. Soon. About JVM introduction can be taken

Http://info.shangdu.com/new/2003-3-19/2003319102138.htm

API documentation:

Http://java.sun.com/j2se/1.5.0/docs/api/

I am here today in Core Java today. It is to help understand the Java application interface. My understanding is equivalent to help. After all, all kinds of methods we can't remember all ..... Installation JDK .. very Simple. The variables of PATH and ClassPath are usually set after installation. Location: Computer Properties - Advanced - Environment Variable (2000.xp System. 9X should be similar) ClassPath:.; D: /JAVA/JDK1.5.0/bin; d: /java/jdk1.5.0/lib /dt.jar;d:/java/jdk1.5.0/lib/tools.jar (my JDK is installed in D: / java / down directory) I don't quite understand. I probably said. "." Refers to the Java default directory. Add /bin;dt.jar;Tools.jar after the back, you may have to use the compiler, tool. Path:

D: /java/jdk1.5.0/bin;% systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; this is easy to understand. The book says. As for why. I haven't seen it yet. After the ALL OK. Start the Try HelloWorld program: Use a notepad (I don't recommend) to create a HelloWorld.java recommended to use textpad or jcreator or Xemacs (I just use this) download address: http: // www. Gnu.org/software/emacs/windows/ntemacs.html If you do not install it, choose the network installation. Public class welcome {public static void main (string [] args) {system.out.println ("Hello World!"); }

Under the shell (MS CMD) command: Javac HelloWorld.javajava HelloWorld uses Xemacs tools. Direct JDE - Compile, Run Appok? See helloworld? See you (reproduced) * Error 1: 'Javac' is not internal or external commands, nor is it runable or batch files. (Javac: Command Not Found) The reason is that the environment variable Path is not set. Add Path =% Path% under AutoExce.bat; C: /JDK1.2/bin, then Under Control Panel -> System -> Advanced -> Environment Variables -> System Variables ... See? Double click on Path, add C: /JDK1.2/bin in the back. Of course, we assume that JDK is installed in a C: /JDK1.2 directory (a little Tang Yan?) ... It seems to restart the system to work ... (// know! // Tomato) Good, try again ! Javac HelloWorld * Error 2: HelloWorld Is An Invalid Option or Argument. Please give some professionalism, Java source program is necessary to save .java file? And write all .java when compiling. OK, Javac HelloWorld.java (this time should I become?) * Error 3: HelloWorld.java: 1: Public class helloworld Must Be defined in a file callaled "helloWorld.java" .public class helloworld {^ This problem It is because your name is inconsistent with the name of the file. (Who said, clearly seeing people have such a writing; () OK, accurately said that a plus class can be defined in a Java source program, but the classes with public properties can have one, and The name is consistent. Also, the main method must put in this public class, so that you can Java (run) this class. Another thing is that the Java language is strictly sized, and beginners should pay attention to it. In the case, helloWorld and HelloWorld think are different, so ... oh ... good, change, 嘻 ... ... javac helloworld.java ... (咦, what is there?) // Faint This is the compilation pass! See if you have a HelloWorld.class? (Hehe .. Press the book :) Java HelloWorld (!! I know, not java helloworld.class 哟) * Error 4: Exception in Thread "main" java.lang.noclassdeffounderror: HelloWorld huh, this is the famous classpath problem. In fact, class path is the concept of Java involved in the compilation process. ClassPath is to find where to find The class used is as simple. Since our HelloWorld is useless, there is no encounter with this problem when compiling. Run, you must specify where your class is . Solution, you can run: java -classpath. HelloWorld ".", Represents the current directory.

转载请注明原文地址:https://www.9cbs.com/read-104056.html

New Post(0)