This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 18136
    
  39


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: 19552
    
  16

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
 
Similar Threads
WEB-INF\classes folder
problem with struts
problem with using javac -d ?
struts
neither action class called nor jsp page displayed