|
Hi Sudha, <snip> I made some progress but I am back to class not found error, when I have the CLASSPATH defined. To explain further, I have the jar in '/junk'. In classpath, I have CLASSPATH=.:/QIBM\... :/junk/Ostermiller_1.jar'. (Is it case sensitive perhaps? I know the environment variable is case sensitive.) The class Browser is in com.Ostermiller.util package. In qsh, I go to '/junk' and give the java command and get the error. Also, Can I get more information on the error somehow? .. java com.Ostermiller.util.Browser.displayURL <http://www.yahoo.com/> http://www.yahoo.com </snip> >From your java command, it would "appear" that you are trying to call the displayURL static method of the Browser class. You can't do this. Even though the displayURL method is static, and therefore doesn't need a Browser object to be instanciated, you can't just call it from a command line. The only method that can be called via the java command is the public static void main method. This method takes a space-delimited String array as an argument. So, if you use the command: java com.Ostermiller.util.Browser http://www.yahoo.com. This will attempt to call public static void Browser.main(String[] args). In this case, your passing a single String. If you use the command you're using: java com.Ostermiller.util.Browser.displayURL <http://www.yahoo.com/> http://www.yahoo.com. This will attempt to call <access modifier> <return type> Browser.displayURL(String argv). This is not allowed. (Also, I would suggets ostermiller - not Ostermiller. By convention, only class names begin with a Capital letter.) Now, inside your Ostermiller_1.jar file you MUST have a directory structure that matches your package name - the first line of your java source should have: package com.ostermiller.util;. You must then include the Ostermiller_1.jar file in your classpath. It's the classpath plus the package definition that is used to locate the class object. Thus, the java class loader would look for your Browser class in /junk/com/ostermiller/util. If you haven't got your class in directory com/ostermiller/util WITHIN your jar file then the class loader wont find your class. HTH, and good luck. Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.