Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Computer Laboratory – Course pages 2014–15: Getting Access to Java at Home Skip to content | Access key help Search Advanced search A–Z Contact us Computer Laboratory Computer Laboratory Teaching Courses 2014–15 Object-Oriented Programming Getting Access to Java at Home Computer Fundamentals Digital Electronics Discrete Mathematics Foundations of Computer Science Hardware Practical Classes ML Practical Classes Object-Oriented Programming Programming in Java Registration Algorithms Operating Systems Further Java Briefing Numerical Methods Software and Interface Design Course pages 2014–15 Object Oriented Programming Syllabus Course materials Getting Access to Java at Home Information for supervisors Getting Access to a Java compiler As with Poly/ML there many options for you to get access to a machine running a Java compiler, including: MCS. MCS machines can be found throughout Cambridge, including the Intel Room in the Computer Laboratory and (very probably) your College. P More details on the MCS in general can be found here. Remote MCS Linux. You can access an MCS linux machine from your own computer via SSH. More details are here. Your computer See below. Obtaining the basic Java compiler and libraries Everything you need is rolled into what are called Java Development Kits (JDKs). Jave is an open specification and there are lots of JDKs you can choose from--any should be fine. The 'official' choice is the Oracle product: see here. Alternatively, you could use OpenJDK: see here. The latter is potentially easier for Mac users since you can use the MacPorts program you used to install poly/ML. Try running sudo port install openjdk7 (I think this is right, but haven't got a Mac to try it: let me know if it fails). If you want to play with Java 8 then obviously get the Java~8 varinat of the JDK. Once installed, there are two programs you care about. One is the Java compiler (javac) and the other is the Java Virtual Machine that can run the bytecode (just java. If you have installed the JDK as per the instructions, starting up a terminal or console (as you did with poly) and typing either javac or java should do something (albeit not much that's useful. You can do a full test as follows Create a new text file called Test.java Copy/paste the following code into the file and save it: public class Test { public static void main(String[] args) { System.out.println("Hello world"); } } Compile the test code by running javac Test.java. If all goes well, a Test.class file will appear in the same directory (this is the bytecode) Run your shiny new bytecode by typing java Test You should see "Hello world" printed. Obtaining a Prettier Interface In your practicals you will be encouraged to use the command line to compile and run your code. In the OOP lectures, however, an Integrated Development Environment (IDE) called Eclipse is used. If you wish to work using this at home, you can install it by clicking here. Note there are are lots of variants of the program: you are looking for the "Eclipse IDE for Java Developers". © 2014 Computer Laboratory, University of Cambridge Information provided by Dr Robert Harle