Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,195,263 members, 7,957,650 topics. Date: Tuesday, 24 September 2024 at 04:44 PM

Junit: How To Set Classpath On Windows Xp - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Junit: How To Set Classpath On Windows Xp (13733 Views)

How To Install Pyqt On Windows? / Qbasic On Windows Xp / Junit: How To Set Classpath On Windows Xp (2) (3) (4)

(1) (Reply) (Go Down)

Junit: How To Set Classpath On Windows Xp by Taysay(m): 6:08pm On Nov 06, 2006
Goog day friends,
Pls can anybody give me a lead on how to set classpath  for JUNIT  on widows xp ?
I want to be able to run JUNIT outside my IDE as well as via my IDE.tanx have a good one.
Re: Junit: How To Set Classpath On Windows Xp by mimohmi(m): 2:31am On Nov 07, 2006
@Taysay

Sorry for my late response. Ok, all you have to do is add the junit.jar to
your classpath. You don't need to add it to the window classpath, instead
to the javac and java classpath, so that the imported Libraries can be found.
So, from your working directory jusu do this;

javac -classpath c:/junit3.8.1/junit.jar MyTest.java

and to run the test app, you also need to add the junit.jar;

java -cp .;c:/junit3.8.1/junit.jar junit.awtui.TestRunner MyTest

-cp .;c:/junit3.8.1/junit.jar -- Here we are adding the junit libraries to our path.
like telling the JVM, where your included import statements are.
junit.awtui.TestRunner --- This is the TestRunner class, that's actaully running your test class.
You can have also swingui and text test runner. Check the junit doc.

I think you are using netbeans IDE, you don't need to add junit to your classpath,
when you create a new project, a test package is added for you. So all you need to do
is go to the test package, right click and select new -- junit, a junit class is created for
you, so just modify it to suite you requirements. More help pop it here,
will be watching.
You can go through these links for more details on classpath.
Hope, it helps.
http://www.javaden..com
https://www.nairaland.com/nigeria/topic-8060.0.html#msg234211
Re: Junit: How To Set Classpath On Windows Xp by Taysay(m): 6:51pm On Nov 07, 2006
@Mimoh_mi,
Yeah just to say a very big thank you for being there for US, yeah another big thank you for the AGILE JAVA book not forgeting the other's, I was trying to reach u yesterday afternoon, just to let you that I got it going with JNIT via netbeans, but ur # was not available. I am reading the book you gave me its so cool. I will give you a call asap , remain blessed.
Re: Junit: How To Set Classpath On Windows Xp by candylips(m): 9:43pm On Nov 07, 2006
You will be better off compiling your app with ANT. It is not standard practice to just complie from the command line anynore thats newbie stuff.
Re: Junit: How To Set Classpath On Windows Xp by sbucareer(f): 3:20pm On Nov 09, 2006


Here is an ant script that I am using to develop a benchmark application for a core argument on my thesis. You can modify it to correlate your application. Tutorial on ant is here


<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- JBoss build file                                                       -->
<!-- ======================================================================= -->

<project name="JBoss" default="ejbjar" basedir=".">

    <property environment="env"/>
    <property name="src.dir" value="${basedir}/src"/>
    <property name="src.resources" value="${basedir}/src/resources"/>
    <property name="jboss.home" value="${env.JBOSS_HOME}"/>
    <property name="build.dir" value="${basedir}/build"/>
    <property name="build.classes.dir" value="${build.dir}/classes"/>
    <property name="build.javadoc" value="${build.dir}/javadoc"/>
    <property name="classpath.dir" value="${env.JAVA_HOME}"/>

  <!-- Build classpath -->
  <path id="classpath">
<fileset dir="${jboss.home}/client">
    <include name="**/*.jar"/>
</fileset>
      <!-- So that the application hass access to jar files for this particular project -->
<pathelement location="${build.classes.dir}"/>
<!-- So that we can get jndi.properties for InitialContext -->
<pathelement location="${basedir}/jndi"/>
  </path>

  <property name="build.classpath" refid="classpath"/>

  <!-- =================================================================== -->
  <!-- Prepares the build directory                                        -->
  <!-- =================================================================== -->
  <target name="prepare" >
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes.dir}"/>
    <mkdir dir="${build.javadoc}"/>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source code                                            -->
  <!-- =================================================================== -->
  <target name="compile" depends="prepare">
    <javac srcdir="${src.dir}"
   destdir="${build.classes.dir}"
   debug="on"
   deprecation="on"
   optimize="off"
         fork="java$$javac.exe"
         source="1.5" 
   includes="**">
    <classpath refid="classpath"/>
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Package into jar and deploy into the JBoss container                -->
  <!-- =================================================================== -->

  <target name="ejbjar" depends="compile">
    <jar jarfile="build/telebook.jar">
      <fileset dir="${build.classes.dir}">
  <include name="telebook/*.class"/>
      </fileset>
      <fileset dir="${src.resources}/">
  <include name="**/*.xml"/>
      </fileset>
     </jar>
  </target>


  <!-- =================================================================== -->
  <!-- Ddeploy into the JBoss container                                    -->
  <!-- =================================================================== -->
 
  <target name="deploy" depends="ejbjar">
<copy file="build/telebook.jar" todir="${jboss.home}/server/default/deploy"/>
  </target>

  <target name="run.client" depends="ejbjar">
    <java classname="client.TeleBookClient" fork="yes" dir=".">
      <classpath refid="classpath"/>
    </java>
  </target>

  <!-- =================================================================== -->
  <!-- Cleans up generated stuff                                           -->
  <!-- =================================================================== -->

  <target name="clean">
    <delete dir="${build.dir}"/>
    <delete file="${jboss.home}/server/default/deploy/telebook.jar"/>
    <delete file="${basedir}/build"/>

  </target>

  <!-- =================================================================== -->
  <!-- Build javadoc                                                       -->
  <!-- =================================================================== -->

  <target name="run.javadoc" depends="compile">
    <javadoc packagenames="telebook.*,client.*"
     sourcepath="${src.dir}"
     destdir="${build.javadoc}"
     author="true"
     version="true"
     use="true"
     windowtitle="Tele Book Application API">

    <doctitle><![CDATA[<h1>Tele Book Application API</h1>]]></doctitle>
    <bottom><![CDATA[<i>Copyright &#169; 2006 Ph.D Enterprise Computing London South Bank
                                                   University. All Rights Reserved</i>]]></bottom>
    <tag name="todo" scope="all" description="Do all:"/>
    <group title="Telebook EJB API" packages="${src.dir}/telebook"/>
    <group title="Telebook Client API" packages="${src.dir}/client"/>
    <link offline="true" href="=http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="c:\tmp"/>
    <!--<link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>-->
    <classpath refid="classpath"/>
   </javadoc>
  </target>

</project>

Re: Junit: How To Set Classpath On Windows Xp by Seun(m): 3:31pm On Nov 10, 2006
sbucareer: isn't that a little bit offtopic?
Re: Junit: How To Set Classpath On Windows Xp by sbucareer(f): 3:09am On Nov 14, 2006

Read the last post before mine. Sometimes the topic of the post do not bear any correlation to the discusion, hence the argument may digress to facade a point or a learning curve.

My post may have motivated the guy to learn ant or may even have changed his direction to understanding ant. If you understand my post, many people may not, and could facilitate or trigger another new direction to their learning.

Off topic or no off topic, I wanted to show the guy the use of ant script. If you consider my post off topic, next time just pass my post when you see sbucareer

No knowledge is a waste!

Note
-----------

The post was copied and paste from my report paper. I did not edit it.  If some information you find within the ant script annoyed you accept my apologies. Don't think I am a show off. Most of my post are very late at night or early hours of the morning, hence I do not edit most of them. Most of them have even got spelling or grammer errors. This is to to with the fact that I am very busy thesedays and I am trying to keep up with this forum and other forums that I service.

Seun, you have exclusive right to edit my post if you see fit, I will never complain.
Re: Junit: How To Set Classpath On Windows Xp by sbucareer(f): 12:24pm On Nov 15, 2006

@Prodgalson, I have matured more since I joined Nairaland. You will NEVER see me arguing with anyone . Everyone is entitled to their opinion, hence freedom of speech.

Infact, I have learned so much from criticisms. I will never take offense and would rather learn from it. If you noticed right from time, pardon me never seize to come out from my mouth.

Let me use this opportunity to say this. I do not claim or believe I know more than anybody in Nairaland relating to IT or try to prove that I am jack of all trade in IT.

I have noticed many brilliant people here with limited access to IT devices and software including internet connection problems. Given the opportunity I had, they would be undoubtable good in IT.

My knowledge span several years of dedication and some commercial experience, beyond that we are all the same. So please don't get me wrong in any other way that I am trying to be noticed and knowledable.

What I post here are all part of my experiences and skills, nothing more nothing less. I hope I have cleared the air. We should look beyond who knows what and work hand in hand to achieve a goal.

I always believe that students always become better to their teachers.
Re: Junit: How To Set Classpath On Windows Xp by khuna(f): 10:17am On Dec 05, 2006
@ sbucareer
do not mind seun or proqalson u are simply wonderful and ok and your IT knowledge is fabulous pls keep posting
but i enjoy your the post on java for dummies most. wink wink wink wink wink wink wink wink
Re: Junit: How To Set Classpath On Windows Xp by mimohmi(m): 1:32am On Dec 08, 2006
@Hi to All

What an interesting twist, believe we are all learning. Nobody is a guru,
but some people just had to start before others. So, let's keep it cool and
stop attacking each other. We all can't be right and same time can't be
wrong all the time. I don't believe in any knowledge being out of scope.
It just shows that whatever level, we think we are, it can just be better.
So make una take am easy.

Please can you guys help me shed more light on this two words.
Fine grained and coarse grained as it affects enterprise application
especially with EJB and Persistent Entities.
I am presently sweeting it out with SCBCD 5.0 beta.
Thanks.
Re: Junit: How To Set Classpath On Windows Xp by sbucareer(f): 10:39am On Dec 10, 2006

@Mimoh

It has been some time now I last heard from you. Sorry, I have been too busy lately. I will call you before Xmas. How is everything. I got your email regarding the Satellite project and I will email you soonest. How is business or work and life hope you are winning, if do doxology.

Regarding JEE 5.0 fine grained concept is the separation of every object into one EJB more like cohesive programming in software engineering. All your objects like

1. Login
2. Shopping cart
3. Browsing
4. Catalog
5. Line item
6. Order
7. Confirmation (Messaging)

All these objects are their own individual EJB. It is fine grained so that during maintenance and migration or system termination, running it parallel with other legacy or new EJB 6.0 (Who knows) would not pose myriad problems.

Coarse grained is just the opposite more like coupling in software engineering. It is like a "fat" EJB, containing lots of application logic. Not very clever for integration and migration even most importantly maintenance. In coarse grained you see the lists of objects mentioned above will be in one EJB.

There are pro's and con's to each approach - in general to speed and life cycle management by the container, coarse grained EJB's seem to be preferred to fine grained. Some have stipulated these reasons:

Coarse grained:
======================
1. CMP harder to set up
2. Simpler deployment
3. Less distribution
4. Fewer EJB calls - less network load, fewer transaction context
5. Potentially less reuse
6. Fewer objects for the application programmer to learn


I hope this helps. I will call you this week OK. Take care
Re: Junit: How To Set Classpath On Windows Xp by mimohmi(m): 10:34pm On Dec 31, 2006
sbucareer
[tt][/tt]
Hey, long time. howz job and the family ?
Hope all is well. Finally did the exam last
friday. 180 questions in 5 hrs. Got tired after
about 3 hrs. Hope to give you a call soonest.
Best regards and thanks for your answer above.

(1) (Reply)

Can I Learn Programming With My Smartphone / 10 Years Anniversary Of Nairalander Programmer / Do You Need To Be A Math Guru To Be A Good Programmer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.