Eric
Eric

Reputation: 39

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?

Upvotes: 2

Views: 6903

Answers (4)

GreenMatt
GreenMatt

Reputation: 18570

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.

Upvotes: 0

jshalvi
jshalvi

Reputation: 72

I haven't touched Java in years, but Sun's Java tutorial is probably all you'll need:

Upvotes: 1

Thomas Owens
Thomas Owens

Reputation: 116161

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.

Upvotes: 7

notnoop
notnoop

Reputation: 59299

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?

Upvotes: 1

Related Questions