13
Nov
09

Setting CLASSPATH for Java in Linux

This was really tough for me since I had never used command line for compiling java programs, I always used Netbeans for coding in Java. Recently I started learning JUnit for which I decided to use command Line.

Whenever I googled for its solution I got
$ export CLASSPATH=$CLASSPATH:

But this did not fix my problem. Eventually I landed up on some websites and finally here. Though it is mainly written for Windows but can be used likewise for linux also.

So the thing to be done is either add all the jar files explicitly to the classpath or put all the jars in a directory (/home/roshan/jars for me).

Now run this command:
$ export CLASSPATH=$CLASSPATH:/home/roshan/jars/*

The wildcard ‘*’ fixed the problem. Now you can make this change permanent by adding this command to your .bash_profile in home directory or /etc/profile to make system wide changes.


0 Responses to “Setting CLASSPATH for Java in Linux”



  1. No Comments Yet

Leave a Reply




Blog Stats

  • 21,090 hits

Email Subscription

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

 

November 2009
M T W T F S S
« Oct    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Cluster Map

Tweets

Google Groups
GNU/Linux Users' Group, NIT Durgapur
Visit this group

openSUSE

Email Subscription

Enter your email address to subscribe to this blog and receive notifications of new posts by email.