java - Setting classpath for a jar and a class -


i need set classpath servlet-api.jar , class in order compile file.java. how accomplish that? have tried

javac -cp /path/to/servlet-api;/home/user/desktop/other.class file.java 

however not work.

any help? aware it's possible set environment variable know if it's possible manually.

the classpath must contain jar files, , directories. directories must directories containing root of package tree. so, assuming other in package com.foo.bar, , class file /home/user/desktop/com/foo/bar/other.class, classpath should be

-cp /path/to/servlet-api.jar:/home/user/desktop 

note : path separator on unix. ; windows. assume you're not on windows since path /home/... , not c:\home\...

ps: if other not in package, fix that. classes should in package.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -