Junit: How To Set Classpath On Windows Xp

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 21, 2009, 08:25 AM
430312 members and 297433 Topics
Latest Member: Desdo
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Junit: How To Set Classpath On Windows Xp
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Junit: How To Set Classpath On Windows Xp  (Read 9910 views)
Taysay (m)
Junit: How To Set Classpath On Windows Xp
« on: November 06, 2006, 06:08 PM »

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.
mimoh_mi (m)
Re: Junit: How To Set Classpath On Windows Xp
« #1 on: November 07, 2006, 02:31 AM »

@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.blogspot.com
http://www.nairaland.com/nigeria/topic-8060.0.html#msg234211
Taysay (m)
Re: Junit: How To Set Classpath On Windows Xp
« #2 on: November 07, 2006, 06:51 PM »

@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 your # was not available. I am reading the book you gave me its so cool. I will give you a call asap , remain blessed.
candylips (m)
Re: Junit: How To Set Classpath On Windows Xp
« #3 on: November 07, 2006, 09:43 PM »

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.
sbucareer (f)
Re: Junit: How To Set Classpath On Windows Xp
« #4 on: November 09, 2006, 03:20 PM »



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>

Seun (m)
Re: Junit: How To Set Classpath On Windows Xp
« #5 on: November 10, 2006, 03:31 PM »

sbucareer: isn't that a little bit offtopic?
sbucareer (f)
Re: Junit: How To Set Classpath On Windows Xp
« #6 on: November 14, 2006, 03:09 AM »


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.
sbucareer (f)
Re: Junit: How To Set Classpath On Windows Xp
« #7 on: November 15, 2006, 12:24 PM »


@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.
khuna (f)
Re: Junit: How To Set Classpath On Windows Xp
« #8 on: December 05, 2006, 10:17 AM »

@ 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
mimoh_mi (m)
Re: Junit: How To Set Classpath On Windows Xp
« #9 on: December 08, 2006, 01:32 AM »

@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.
sbucareer (f)
Re: Junit: How To Set Classpath On Windows Xp
« #10 on: December 10, 2006, 10:39 AM »


@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
mimoh_mi (m)
Re: Junit: How To Set Classpath On Windows Xp
« #11 on: December 31, 2006, 10:34 PM »

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.
 Connecting To A Database Using Visual Basic  Top Earners in the Nigerian Software Industry  Project Topics In Computer Science  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.