简体   繁体   中英

How to run Java Programs

I am just starting Java but I know Scheme...How do you run java code using emacs and putty? I made a program and saved it as first.java on emacs and when i try to open it in putty i did load "first.java" but nothing happened so how do you do this and can yo write Java code in Dr.Scheme?

First, you have to name your file the same as the public class that is contained in the file. Then, once your class is written, you need to compile it using javac and run the .class file that is produced using the command java [ClassName] .

A few things to note is that you are going to make sure you have a Java Development Kit (JDK) and that your path is set up so that javac and java are on the path.

I would poke around the Java Tutorials , specifically the "Hello World" application example .

To run Test class, you need to compile the file and run it. Here is how you can do it from the command line.

javac Test.java
java Test

Unfortunately, I cannot comment on using DrScheme (which is a Scheme IDE) for developing Java. Do you mean that you want to invoke Test class from within Scheme?

我多年没有接触过Java,但Sun的Java教程可能就是你所需要的:

Others have already said to make sure your class name matches the java source file name and to run javac on that, and then java on the resulting .class file. Also, make sure your classpath is properly set when you compile and run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM