whenever i typed a package program i get an error message "the package does not exist". so please help me to run this program
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
whenever i typed a package program i get an error message "the package does not exist". so please help me to run this program
Programs in packages are required to be saved in a directory structure that matches the package structure. For example, start with s simple program, like:
Save the file to a subdirectory of your typical source file location called simpleprogram (the same as the package name).
Change to the directory simpleprogram and compile the source file using the command:
$ javac TestProgram2.java
(The '$ ' is a prompt, not part of the command.)
If you try and run the program while in that directory with the command java TestProgram2, you'll get an error. However, if you move up one level in the directory structure and then run the program using the command:
$ java simpleprogram/TestClass2
it will work.
If you have trouble following these directions and making it work, come back and describe exactly what you've done with any error messages you get.