This week's book giveaway is in the General Computing forum.
We're giving away four copies of Raising Young Coders: A Parent’s Guide to Teaching Programming at Home and have Cassandra Chin on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Question Regarding ClassPath with Eclipse/JBoss

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I have a quick question ( not as hard as my usual questions ) regarding the .classpath in Eclipse.

My question is, during deployment, what happens to that file?

I noticed that when I got to the test server, that there is another file with a similar name, classpath.sh in the JBoss directory.

It does not have the classpathentry items on it at all.

Could someone let me know how the .classpath gets encapsulated into the .war file? Is it packaged?

If I am doing a deployment where I am directed to add classpath entries to a couple of jar files, how can I be sure that the .war file is going to point to the proper jars?

Do I need to re-package the entire workspace? I am not sure, this is why I am asking.

Normally, we ftp everything from the workspace to the test server. I am not sure if this methodology is widespread.

Thank you,
 
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.classpath is purely Eclipse and sits alongside .project

You should not need .classpath in JBoss at all.

All you should be ftping to the deploy folder (or equivalent) is the generated war archive, or exploded target/war.

WP
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this mission critical if I have changed the .classpath on the development machine?

The reason why I ask is that up to and including this time point, I have just made changes to the servlets and xsl pages.

Thanks for clarifying,

Let me know,

Thank you,
 
William P O'Sullivan
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. The local .classpath is the Eclipse Java Build path. Edit it and you'll see what I mean.

When deployed, the servlet container (JBoss) determines the classpath, WEB-INF/lib etc.

WP
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry William I may not be asking the right question.

Should I build the entire .war file and redeposit it on the test server, if I have edited the .classpath?

the four (4) .jars that I have added to the project are as follows:
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/esapi-2.0.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/log4j-1.2.12.jar"/>
<classpathentry kind="lib" path="C:/jakarta-tomcat/lib/servlet.jar" sourcepath="C:/jakarta-tomcat/lib/servlet.jar"/>
<classpathentry kind="lib" path="C:/jakarta-tomcat/common/lib/servlet-api.jar"/>

Thank you,
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michele Smith wrote:Should I build the entire .war file and redeposit it on the test server, if I have edited the .classpath?


It depends.

Are you using different versions of the JARs that you referenced? If so, you want want to rebuild the WAR so that it includes the correct versions of the JARs.

If not, then you don't have to rebuild the WAR. Also, if you changes a reference to a JAR that doesn't get packaged with your WAR (such as the servlet.jar), then there is no need to rebuild the WAR.

So ask yourself - if you rebuild the WAR, will the contents be different? If yes, rebuild. If not, skip it.
 
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michele, the .classpath file in Eclipse is totally irrelevant in JBoss. Even if you include the .classpath from Eclipse in the WAR that you deploy to JBoss, JBoss will never use it.

Putting JAR files that your application is dependent on in WEB-INF/lib usually takes care of the classpath issue. See: http://java.sun.com/j2ee/verified/packaging.html for more options
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To make it a bit more clear - when developing and deploying applications, there are multiple classpaths involved at various levels/stages. When you are developing an application you'll need compile/build time classpath references to various other libraries. If an IDE is involved it will have its own way of setting up this classpath. For Eclipse it's the .classpath file. If you aren't using an IDE then there will other build tools like Ant which have their own way of specifying classpath. All these classpaths are build/compile time classpaths and don't play a role when you deploy the application to a server like JBoss. So those .classpath files are of no relevance at that time.

The deployment/runtime classpath is determined by the packaging of your application. The Java EE spec has specific rules on how the dependent libraries should be packaged within the application and how they play a role in the runtime/deployment time classpath. For example, all jars in the .war/WEB-INF/lib of your application are available in the classpath of the application being deployed. There's also server specific ways of adding additional libraries to this classpath, but I won't go into those details since that's irrelevant.
 
reply
    Bookmark Topic Watch Topic
  • New Topic