S
Siripong
Dear All
I am a new java programmer and now I have some problem about java.
I have 2 files java programs.
This is a first file (User.java)
package usejava;
import java.io.*;
public class User
{
public String Name;
public User()
{
Name = "I am the man";
}
}
I can compile this file by this command
javac User.java
I can get file User.class .
And second file is Login.java .
import usejava.*;
import java.io.*;
public class Login
{
public static void main(String args[])
{
User u = new User();
System.out.println(u.Name);
}
}
When I compile second file I got error "Don't know package
usejava.*"
So I create jar file by this command.
jar cf usejava.jar *.class
And set CLASSPATH by this command.
CLASSPATH=/root/usejava.jar;export CLASSPATH;
And I compile second file again I got same error. Please let's me
know what happend and how to fix this problem.
Best Regards,
Mod X
I am a new java programmer and now I have some problem about java.
I have 2 files java programs.
This is a first file (User.java)
package usejava;
import java.io.*;
public class User
{
public String Name;
public User()
{
Name = "I am the man";
}
}
I can compile this file by this command
javac User.java
I can get file User.class .
And second file is Login.java .
import usejava.*;
import java.io.*;
public class Login
{
public static void main(String args[])
{
User u = new User();
System.out.println(u.Name);
}
}
When I compile second file I got error "Don't know package
usejava.*"
So I create jar file by this command.
jar cf usejava.jar *.class
And set CLASSPATH by this command.
CLASSPATH=/root/usejava.jar;export CLASSPATH;
And I compile second file again I got same error. Please let's me
know what happend and how to fix this problem.
Best Regards,
Mod X