How can i add new library in java ubuntu


 
Thread Tools Search this Thread
Top Forums Programming How can i add new library in java ubuntu
# 1  
Old 05-07-2009
How can i add new library in java ubuntu

Hello

I had been download weka.jar file and I need to call this library in a Java program
Code:
import weka.*;

how could I make my Java compiler identify it

My OS is ubuntu

thanks
# 2  
Old 05-07-2009
Once you have imported the necessary classes, you need to add that .jar to the CLASSPATH before you compile it.
# 3  
Old 05-07-2009
How could I add it to CLASSPATH
# 4  
Old 05-08-2009
Quote:
Originally Posted by vip_a1
How could I add it to CLASSPATH
If you are on bash,

Code:
export CLASSPATH=$CLASSPATH:/path/to/weka.jar

# 5  
Old 05-09-2009
I did it
but it gives me the following error when i compile it

javac a.java

a.java:1: package weka does not exist
import weka.*;
^
1 error
# 6  
Old 05-10-2009
try javac -classpath /path/to/weka.jar a.java

btw you could add the classpath to your .profile in your $HOME...add the line that vino said into your .profile file and logout and log back in
# 7  
Old 05-10-2009
You can't import weka.*. weka is the top level package path in the weka API. It does not contain any classes, only sub-packages. You need to import the actual packages you need.

You can consult the javadoc to see what you need to impoty.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Programming

How to make use others' C library installed not for the system-wide (Ubuntu/Linux)?

I have downloaded and installed a library called htslib for specific bioinformatic use but not for the system (I'm using Ubuntu 18.04). Only parts of the library is needed for my exercise to parse data in a type called VCF format (basically tab-delimited file but contains many information in... (14 Replies)
Discussion started by: yifangt
14 Replies

2. Solaris

Add new EML 103e Tape Library in SUN Solaris Host to implement HP DP

Hi, Our environment is SUN Solaris. We have purchased HP EML 103e tape library. Can you please let me know do I need to install any Driver of newly added Tape Library to see from the Solaris Host? or how can i see the tape library from my Solaris hosts. Thanks, Hassan (0 Replies)
Discussion started by: M_Hassan
0 Replies

3. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

4. Linux

./configure problem for libsf library due to apparently missing libdb library.

Hello, ./configure script fails to configure libsf. Please check the following last few lines of configure script error. checking for db1/db.h... no checking for db.h... yes checking for dbopen in -ldb1... no configure: error: No libdb? No libsf. But find command shows the following; ... (4 Replies)
Discussion started by: vectrum
4 Replies

5. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies
Login or Register to Ask a Question