A snippet:

package com.deitel.jhtp7.ch14;
public class AccountRecord
{
.....

Doubt:
1. What does the above package statement imply. As in how(path) this AccountRecord.java will be stored? As in what folder hierarchy should I create?

2. In Command prompt I have set my Current Directory as :
E:\RDL\Dropbox\Coding\Core Java\File
So will the file AccountRecord.java be inside the above folder structure?

3. E:\RDL\Dropbox\Coding\Core Java> set path=%path%;C:\Program Files\Java\jdk1.6.0_24\bin
This is how I set path to the jdk, is that of any significance for package as in do I have to do anything with this to store the .java and .class file and compile and execute process?

4. Also what should be the compile and execute command based on above package?

Please explain in easy terms.
Thanks in advance.

I'd start with a simple package with a single path/symbol. Write some code, compile it and execute it to see how it works.

Edited 4 Years Ago by NormR1: n/a

A snippet:

package com.deitel.jhtp7.ch14;
public class AccountRecord
{
.....

Doubt:
1. What does the above package statement imply. As in how(path) this AccountRecord.java will be stored? As in what folder hierarchy should I create?

2. In Command prompt I have set my Current Directory as :
E:\RDL\Dropbox\Coding\Core Java\File
So will the file AccountRecord.java be inside the above folder structure?

3. E:\RDL\Dropbox\Coding\Core Java> set path=%path%;C:\Program Files\Java\jdk1.6.0_24\bin
This is how I set path to the jdk, is that of any significance for package as in do I have to do anything with this to store the .java and .class file and compile and execute process?

4. Also what should be the compile and execute command based on above package?

Please explain in easy terms.
Thanks in advance.

The folder structure should be ....\\com\\deitel\\jhtp7\\ch14\\AccountRecord.java. you should also set your classpath to the above directory after compiling to run it, remember it wont run unless its in that same folder struct as mentioned above and the class path is set to the above directory structure. also i cant see why this package would need any special commands to compile, what you have and compiling normally should be fine.

check here for better explanation:http://docs.oracle.com/javase/tutorial/java/package/managingfiles.html and this http://www.cs.swarthmore.edu/~newhall/unixhelp/debuggingtips_Java.html and lastly: http://shivasoft.in/blog/java/compile-and-run-java-program-in-package-from-command-line/

//heres and example you need to type this command line
//javac -d . Test.java
//that will gernreate the package for you
//example for that

package com.sun.java.test
public class Test {
public static void manin(String args[] )
{
System.out.println( "hello world" );
}

//when you complie this class by using javac -d . Test.java , that will gaurentee
//this folder com/sun/java/test/Test.class
//(Note that this doesn't quite work in Java 1.1.x under Windows, where you need to replace the / by \)
//to run this Class , you need to type this command line
//java com.sun.java.test.Test

Edited 4 Years Ago by DavidKroukamp: n/a

This question has already been answered. Start a new discussion instead.