• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting classpath in Ubuntu  RSS feed

 
Greenhorn
Posts: 9
Chrome Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i set classpath on ubuntu..Please Guide me
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't set a system CLASSPATH; note that on a Linux box you have to call it CLASSPATH not classpath because Linux is case‑sensitive. You want to set a different CLASSPATH for each application; you do that with the -cp option (you may have to apply it both after javac and java). More informaton here. You will probably have to do something like:-
javac -cp ~/Downloads/JarFile1.2.3.jar:. MyJavaClass.java
java -cp ~/Downloads/JarFile1.2.3.jar:. MyJavaClass

Note I have put :. at the end of each CLASSPATH so as to ensure you also find classes in the current directory.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!