Hello prfalco
I know this can be frustrating, but please try to understand that if you can do this, then you can use Java fundamentally without an IDE to spoil you.
I am assuming that your Java compiler and interpreter is working. Lets make sure of the structure:
This is your
Letscheck class with the main() method. Currently it is part of the default package:
import person.*;
public class Letscheck {
public static void main(String[] args) {
name n = new name();
System.out.println(n.get_name());
}
}
This file, called
Letscheck.java, is stored as:
Next, you have your
name class that is part of your person package:
package person;
public class name{
private String name_person= "pablo";
public String get_name(){
return name_person;
}
// Added a constructor for you
public name(){}
}
this file, called,
name.java, is saved as:
Now open command prompt and type
To use javac we do
not need a CLASSPATH. Type the following:
This will compile all your java source code in the "c:\java\person\" directory. Now, we do the same for "c:\java\" to compile the file with your main() method:
Now you should have the files:
c:\java\person\name.class
c:\java\Letscheck.cass
To run a Java program with the
Java interpreter, it
needs a CLASSPATH. To set this, use the command prompt before you use the "java" program. Type this into the command prompt:
Note that all my directories ends with a back slash. Now, to run your program type:
Note that I did not add the ".class" extension. The program should output:
That's all that there is to it. You can do all this quickly by writing a batch file. (.bat)
I really hope this helped you.
