jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Including a jar file while compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Including a jar file while compilation" Watch "Including a jar file while compilation" New topic
Author

Including a jar file while compilation

jagan raja
Ranch Hand

Joined: Jan 29, 2010
Posts: 54
Moderator,

If this topic doesn't belong here please move to the necessary forum.

Hi All,

I am trying to build a struts application manually.

I have got all my .java files in src folder. I have included struts.jar in /WEB-INF/lib folder.

I try to compile my .java file using the following command

javac -d WEB-INF\classes src\com\ilp\struts\action\*.java src\com\ilp\struts\business\*.java src\com\ilp\stru
ts\db\*.java src\com\ilp\struts\formbeans\*.java src\com\ilp\struts\util\*.java


And I get the error saying package org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping so on.

None of the struts classes is not readable.

I dont know how to include my struts.jar while compilation.

Can any one please help me out?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18978
    
  40


Have your tried using a classpath? Either the -cp option or the environment variable?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
jagan raja
Ranch Hand

Joined: Jan 29, 2010
Posts: 54
Thanks henry,

I have included the path of the struts.jar in my classpath and it works fine.

I must have checked my path first.

And henry how to use the -cp option with javac -d WEB-INF\classes src\com\ilp\struts\action\*.java src\com\ilp\struts\business\*.java src\com\ilp\stru
ts\db\*.java src\com\ilp\struts\formbeans\*.java src\com\ilp\struts\util\*.java


Thanks in advance.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

How about typing in "javac" without any parameters? But the solution is simple: just add "-cp <JAR file>" just before the "-d".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jagan raja
Ranch Hand

Joined: Jan 29, 2010
Posts: 54
Thanks all......I am able to deploy my application properly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Including a jar file while compilation