Forums Register Login

Linux, JAVA 5 Package importing problem

+Pie Number of slices to send: Send
Hi,
I am new to linux.
I have managed to install the binaries of java 1.5. I have set the classpath and JAVA_HOME(for tomcat). All these things work fine. I have managed to compile simple java files. However when I try to import another package (that I know exists with compiled classes in it) I get

package <package> does not exist
import <pakcage>
^

I have tried this code on another linux machine and it worked fine. So what is wrong with the environment of the machine I am working on. HOw do I get the compiler to import the requirede packages.

Please help
NS
[ March 04, 2005: Message edited by: Ernest Friedman-Hill ]
+Pie Number of slices to send: Send
A classpath problem maybe ?

try something like
java -cp /path/to/your/package/root:/path/to/your/application application.main_class
+Pie Number of slices to send: Send
import what?

The line as printed isn't a complete Java statement.
+Pie Number of slices to send: Send
 

Originally posted by Tim Holloway:
import what?

The line as printed isn't a complete Java statement.



I edited his message -- HTML is enabled in this forum and he was using "<" and ">" as brackets, so they were invisible.
+Pie Number of slices to send: Send
by <package> I meant package to be variable my package in this case is called pkg1,
so the error will be:

package temp.Neelesh.pkg1 does not exist
import temp.Neelesh.pkg1.*;
^
+Pie Number of slices to send: Send
The problem may be in your CLASSPATH environment variable, it may be helpful if you posted it.
+Pie Number of slices to send: Send
$PATH
/usr/local/jdk1.5.0_01/bin:/usr/kerberos/bin:
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/ssuser/bin

$CLASSPATH

usr/local/jdk1.5.0_01/bin:u01/jfreechart-0.9.15/jfreechart-0.9.15.jar:
/u01/jfreechart-0.9.15/lib/gnujaxp.jar:/u01/jfreechart-0.9.15/lib/jcommon-0.9.0.jar:
/u01/jfreechart-0.9.15/lib/servlet.jar:/u01/jakarta-tomcat-5/common/lib/activation.jar:
u01/axis-1_1/lib/axis.jar:/u01/axis-1_1/lib/axis-ant.jar:/u01/axis-1_1/lib/commons-discovery.jar:
/u01/axis-1_1/lib/commons-logging.jar:/u01/axis-1_1/lib/jaxrpc.jar:/u01/axis-1_1/lib/log4j-1.2.8.jar:
/u01/axis-1_1/lib/saaj.jar:/u01/axis-1_1/lib/wsdl4j.jar:/home /ssuser/com:/home/ssuser/temp/

am I missing something? Note that I can compile a .java file where there are no imports involved. I can also compile files in the same package. I dont understand why I cannot import files
[ March 04, 2005: Message edited by: Ernest Friedman-Hill ]
+Pie Number of slices to send: Send
Go and carefully read this. Make sure you're following it properly, especially this part:


If you are trying to locate classes in a directory, then specify the path up to but not including the name of the package the classes are in. (If the classes are in a package called my.package and they are located in a directory called C:\myclasses\here\my\package, you would set the classpath to be CLASSPATH=C:\myclasses\here).

 
+Pie Number of slices to send: Send
Where is the source file located?
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1850 times.
Similar Threads
Converting byte array to pdfor any filetype using JSF
URGENT - Query on wldeploy
Page Not Found Error w/ JSP
Runtime.getRuntime().exec() not working for me at all...
PropertyNotFoundException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:10:51.