aspose file tools*
The moose likes Beginning Java and the fly likes Compile and deploy from DOS prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile and deploy from DOS prompt" Watch "Compile and deploy from DOS prompt" New topic
Author

Compile and deploy from DOS prompt

Ed Mirsky
Greenhorn

Joined: Apr 22, 2005
Posts: 11
I�m a novice and I need help.

To make the notation simpler (I hope),
Let D� mean Directory
Let DD� mean subdirectory

I was as able to run my application from the DOS command prompt when it had the following structure:

D� myJ2
DinnerMenu.class (has main(String args[] and uses SpringUtilities)
SpringUtilities.class
Calculator.class ( a dialog which uses SpringUtilities)
SquareRootDialog.class (a dialog which uses SpringUtilities)
DD�pac (a subdirectory with many directories)

I decided to put Calculator.class and SquareRootDialog.class in a directory called dlg, and I put SpringUtilities.class into a directory called utl. The new structure of the application is:

D� myJ2
DinnerMenu.class
DD� utl
SpringUtilities.class
DD� dlg
Calculator.class
SquareRootDialog.class
DD� pac
Classes used by Calculator and SquareRootDialog

I import SpringUtilities into DinnerMenu, Calculator, and SquareRootDialog with:
import utl.SpringUtilities;

import SpringUtilities;

( Problem 1)
I need to recompile Calulator.class and SquareRootDialog.class before compiling DinnerMenu.class, but I can�t figure out how to do that. (I�ve been trying for a week.)

I�ve tried the following without success to compile Calculator:

C:>cd\myJ2\dlg
C:\myJ2\dlg>path= C:\Program Files\Java\jdk1.5.0_03\bin
C:\myJ2\dlg>set CLASSPATH=C:\myJ2\utl;C:\myJ2\pac;C:\myJ2\dlg
C:\myJ2\dlg> javac -classpath %CLASSPATH% Calculator.java

SAMPLE ERROR MESSAGE ---------------------------------------
Calculator.java:17: package pac.libr.mat does not exist
import pac.libr.mat.MathLibrary;
^
Calculator.java:18: package pac.libr.sta does not exist
import pac.libr.sta.StatLibrary;
^
Calculator.java:19: package utl does not exist
import utl.SpringUtilities;

------------------------------------------- END ERROR MESSAGE

(Problem 2)
I want to create an executable JAR file. Will this do the job?
CREATE THE JAR FILE
C:\myJ2\dlg>cd\myJ2
C:\>myJ2jar cvf DinnerMenu.jar DinnerMenu*.class dlg

(Problem 3)
Ultimately, I want to run the application. Will this do the job?
RUN THE APPLICATION
C:\myJ2>set CLASSPATH=C:\myJ2\myJar.jar
C:\myJ2>java -classpath "./DinnerMenu.jar" DinnerMenu

(Problem 4)
One last question. I think the jdk1.5 has SpringUtilities. Can I eliminate SpringUtilities.class from my application and import it into DinnerMenu and Calculator with something like: import SpringUtilities;

Thanks in advance for you help,

Ed
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Not an Ant or Maven question as far as I can tell, so moved to the Java in General (beginner) forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Compile and deploy from DOS prompt
 
Similar Threads
Compile and deploy from DOS prompt
Error running JSP file
Compile error Package Does not Exit
RMI Newbie
Compile and deploy from DOS prompt