Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javac: package foo does not exist.

Status
Not open for further replies.

manarth

Programmer
Jul 2, 1999
1,705
GB
The offending file:
Code:
package com.foo.bar;

[red]import com.foo.bar.db.ConnectionManager;[/red]
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Properties;


public class initialise extends HttpServlet {
	[red]private static ConnectionManager cm;[/red]

    public void init(ServletConfig config) throws ServletException {
        super.init(config);

        Properties props = new Properties();

        props = System.getProperties();
        props.setProperty("dbPropertiesFile", config.getServletContext().getRealPath(config.getInitParameter("db")));
        System.setProperties(props);
		[red]cm = new ConnectionManager();[/red]
    }
}
Compiling using javac on windows.

The package structure is as follows:[tt]
D:\blah\myWebApp\
\WEB-INF\
\classes\
\com\
\foo\
\bar\
\initialise.java
\db\
\ConnectionManager.class
\ConnectionManager.java
[/tt]

I have tried setting the classpath to the classes directory (javac -cp D:\blah\myWebApp\WEB-INF\classes). I have checked the case matches between the import statement and the ConnectionManager class.
All standard classes import successfully, as do additional classes from jars placed in the jre lib directory.

Any other ideas, before I go crazy?!

<marc>
New to Tek-Tips? Get better answers - faq581-3339
 
Nevermind, after literally hours of trying all sorts of things, it mysteriously started compiling.

I believe I must have been - consistently - mistyping the classpath. Anyway, all's well that ends well!

<marc>
New to Tek-Tips? Get better answers - faq581-3339
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top