File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes package problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package problem" Watch "package problem" New topic
Author

package problem

Syed Kamran Ali
Greenhorn

Joined: Jun 16, 2002
Posts: 12
hi all,
i have a problem i am trying to make a package abc where i want to put a test.java
i have createst test.java and placed it in abc folder.
But i dont know how to compile my class and then run the class.
I am using windowsXP and jdk1.4.
Please help.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Syed,
u shd try this steps,
1. make sure that u've statement "package abc" on top of the file test.java
2. make sure that u 've abc directory and test.java in there (as u already do have)
3. go to parent directory of the abc directory.
e.g. if u have following directory hierarchy,
c:\myprog\abc>
and test.java is there in this abc directory then,
u shd go to c:\myprog> and then do,
c:\myprog>javac abc/*.java
make sure that u 've "current directory" that is "." in the CLASSPATH. to set this u can do ,
c:\myprog>set CLASSPATH=%CLASSPATH%;. on the prompt and then should try javac as mentioned above.
now to run the code,
c:\myprog>java abc.test
that should do the job..
let me know if u face problems...
regards
maulin
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
also,
i assumed u've the PATH variable set up properly and all...so u are able to execute "java", "javac" etc from any directory..
regards
maulin
Rajeshwari Natarajan
Ranch Hand

Joined: Mar 05, 2003
Posts: 67
If this is how ur class looks like,

from the same level as the abc folder, execute the following commands to compile and run the code.


regards<br />Rajeshwari. N
Syed Kamran Ali
Greenhorn

Joined: Jun 16, 2002
Posts: 12
i have compiled the class by going into the directory abc
setting classpath to f:\abc
and using command javac test.java
a class is generated but the class doesn't run using command
java test witin abc directory. It gives a no commandDeFoundError
Syed Kamran Ali
Greenhorn

Joined: Jun 16, 2002
Posts: 12
Thanks guys its working now there was a problem with class path
Thanks Again
 
Don't get me started about those stupid light bulbs.
 
subject: package problem
 
Similar Threads
representation
Package Compilation
protected member access
Package creation
Problem with Package execution