Java Import Error Package Does Not Exist
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this package does not exist java compile error site About Us Learn more about Stack Overflow the company Business Learn
Java Package Does Not Exist Jar
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x
Package Does Not Exist Java Command Line
Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Java
Java Package Does Not Exist Intellij
Package Does Not Exist Error up vote 15 down vote favorite 3 So there's a folder /usr/share/stuff in the root directory in stuff there are a bunch of java files with package org.name definitions at the top I am running javac test.java where test.java is in a subdomain I added /usr/share/stuff to my class path. and at the top of test.java I add import package does not exist maven org.name But I get a package does not exist error...why? java import package share|improve this question asked Jun 16 '11 at 16:19 algorithmicCoder 2,480113987 add a comment| 4 Answers 4 active oldest votes up vote 16 down vote accepted Are they in the right subdirectories? If you put /usr/share/stuff on the class path, files defined with package org.name should be in /usr/share/stuff/org/name. EDIT: If you don't already know this, you should probably read this: http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/classpath.html#Understanding EDIT 2: Sorry, I hadn't realised you were talking of Java source files in /usr/share/stuff. Not only they need to be in the appropriate sub-directory, but you need to compile them. The .java files don't need to be on the classpath, but on the source path. (The generated .class files need to be on the classpath.) You might get away with compiling them if they're not under the right directory structure, but they should be, or it will generate warnings at least. The generated class files will be in the right subdirectories (wherever you've specified -d if you have). You should use something like javac -sourcepath .:/usr/share/stuff test.java, assuming you've put the .java files
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with java error package system does not exist us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack package does not exist netbeans Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign error package does not exist android studio up Help with packages in java - import does not work up vote 23 down vote favorite 11 I'm a C++ developer - not a java developer, but have to get this code working... I have 2 public classes that will be http://stackoverflow.com/questions/6375179/java-package-does-not-exist-error used by another product. I used the package directive in each of the java files. package com.company.thing; class MyClass ... When I try to compile a test app that uses that I add import com.company.thing.*; The javac compiler fails with errors about com.company does not exist. (even if I compile it in the same directory as the class files I just made a package of) I am sure I am doing something bone-headed and silly. I've read the http://java.sun.com/docs/books/tutorial/java/package/usepkgs.html pages and tried to set http://stackoverflow.com/questions/631682/help-with-packages-in-java-import-does-not-work up a directory structure like /com/company/thing etc, but either I have totally screwed it all up or am missing something else. EDIT thanks for the suggestions - I had tried the classpath previously. It does not help. I tried compiling javac -classpath
Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: Java in General https://coderanch.com/t/496550/java/java/package-exist-error "package does not exist" error Shajid Johnny Ranch Hand Posts: 34 posted 6 years ago Dear members, I am developing a Java web project. in my 'src' folder- I have the following two classes: 1) package com.foo.model; //import statements public class BookExpert{ //some method implementation } 2) package com.foo.controller; import com.foo.model.*; public does not class BookSelectServlet extends HttpServlet{ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ //calling the model class BookExpert be = new BookExpert(); } } First, from my project root directory I compiled the model class: E:\SCWCD preparation\HF Projects\javaEbook>javac -cp "C:\My Tools\apache-tomcat- 6.0.20\apache-tomcat-6.0.20\lib\servlet-api.jar" -d classes src\com\foo\model\BookExpert.java But later when I tried to compile the controller does not exist servlet: E:\SCWCD preparation\HF Projects\javaEbook>javac -cp "C:\My Tools\apache-tomcat- 6.0.20\apache-tomcat-6.0.20\lib\servlet-api.jar" -d classes src\com\foo\controller\BookSelectServlet.java I got the following errors: src\com\foo\controller\BookSelectServlet.java:8: package com.foo.model does not exist import com.foo.model.*; ^ src\com\foo\controller\BookSelectServlet.java:25: cannot find symbol symbol : class BookExpert though the model class BookExpert was successfully built inside the classes/com/foo/model directory, still the controller servlet did not compile please anyone help me out of the pain i am suffering from the last night Steve Luke Bartender Posts: 4181 22 I like... posted 6 years ago You never add "E:\SCWCD preparation\HF Projects\javaEbook\classes\" to your classpath, so the package found at E:\SCWCD preparation\HF Projects\javaEbook\classes/com/foo/model/ can't be found. Steve Shajid Johnny Ranch Hand Posts: 34 posted 6 years ago Steve Luke wrote:You never add "E:\SCWCD preparation\HF Projects\javaEbook\classes\" to your classpath, so the package found at E:\SCWCD preparation\HF Projects\javaEbook\classes/com/foo/model/ can't be found. so, what should I do now? should I add this classpath into the command line with the older one: E:\SCWCD preparation\HF Projects\javaEbook>javac -cp "C:\My Tools\apache-tomcat- 6.0.20\apache-tomcat-6