Javac Package Does Not Exist Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and package does not exist java command line policies of this site About Us Learn more about Stack Overflow the
Java Package Does Not Exist Jar
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Compilation Error Package Does Not Exist Maven
Badges Ask Question x 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
Java Package Does Not Exist Intellij
a minute: Sign 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 used by another product. I used the package directive in each of the java files. package javac package does not exist jar 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 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
here for a quick overview of the site Help Center Detailed answers to any questions you might have java error package system does not exist Meta Discuss the workings and policies of this site About Us package junit.framework does not exist maven Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads error package does not exist android studio with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, http://stackoverflow.com/questions/631682/help-with-packages-in-java-import-does-not-work just like you, helping each other. Join them; it only takes a minute: Sign up Java 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 http://stackoverflow.com/questions/6375179/java-package-does-not-exist-error 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 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
Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: https://coderanch.com/t/617346/java-Web-Component-OCEJWCD/certification/javac-compile-import-package-BeerSelect Web Component Certification (OCEJWCD) javac compile import package BeerSelect.java:3: error: package com.example.model does not exist jing ma Greenhorn Posts: 10 posted 3 years ago http://www.theserverside.com/discussions/thread.tss?thread_id=60223 I am working on the Head Servlet&JSP book projects. I can not recognize import packages and can not compile. can anyone so kindly help me about does not this? I google online about the classpath. but I might misunderstand it. Please help me about this Thanks! There is a problem about javac compiling. Here is my development directory structure project directory C:\Users\myname\Documents\JSP\MyProject\beerV1 under beerV1 I followed the book, the BeerSelect.java source file is in C:\Users\myname\Documents\JSP\MyProject\beerV1\src\com\example\web the BeerExpert.java source file does not exist is in C:\Users\myname\Documents\JSP\MyProject\beerV1\src\com\example\model the code of BeerSelect.java package com.example.web; import com.example.model.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.Iterator; import java.util.List; public class BeerSelect extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String c = request.getParameter("color"); BeerExpert be = new BeerExpert(); List
"); Iterator
try: " + it.next()); } } } the code of BeerExpert.java compiled with commandline under windows7: C:\Users\myname\Documents\JSP\MyProject\beerV1\src\com\example\model> javac -classpath C:\tools\tomcat\lib\servlet-api.jar -d C:\Users\myname\Documents\JSP\MyProject\beerV1\classes BeerExpert.java it comiled and generated the BeerExpert.class under directory C:\Users\myname\Documents\JSP\MyProject\beerV1\classes\com\example\model package com.example.model; import java.util.*; public class BeerExpert{ //public List getBrands(String color){ //List brands = new ArrayList(); //if (color.equals("amber")){ brands.add("Jack Amber"); brands.add("Red Moose"); }else{ brands.add("Jail Pale Ale"); brands.add("Gout Stout"); } return(brands); } } when I try to compile the BeerSelect.java it can not import package com.example.model.BeerExpert.class Here is my commandline to compile BeerSelect.java C:\Users\myname\Documents\JSP\MyProject\beerV1\src\com\example\web> javac -classpath C:\tools
Java testing Databases Java development in cloud Java DevOps Modular code EJB specification Modular containers Modular troubleshooting Programming code App servers Modular tools Java in the cloud Java Web services WS* specs Architecture Java middleware Spring Hibernate Servlets JSP Java client platforms Framework JSF Web portals UI Enterprise Java development JSRs and APIs Languages JVM languages DSLs Java app deployment Java tools Java performance Java performance Cloud platforms JVM tuning Java HPC Web dev tools Development tools Open source strategy IDEs Java platforms Java testing Development hardware Mobile app dev Mobile development and deployment Mobile cloud apps Mobile platforms Mobile ALM Mobile app testing SEARCH this site and the web Site Index Home>Discussions>Web tier: servlets, JSP, Web frameworks>"package does not exist" error Email This Discussions Web tier: servlets, JSP, Web frameworks: "package does not exist" error Get thread feed "package does not exist" error (1 messages) Posted by: Johnstoppable Johnny Posted on: May 23 2010 08:02 EDT Dear members, I am developing a Java web project. in my 'src' folder- I have the following two classes: 1) packagecom.foo.model; publicclassBookExpert{ //somemethodimplementation } 2) packagecom.foo.controller; importcom.foo.model.*; publicclassBookSelectServletextendsHttpServlet{ publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse) throwsIOException,ServletException{ //callingthemodelclass BookExpertbe=newBookExpert(); } } 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 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 Reply to this Threaded Messages (1) "package does not exist" error by Wendy Specht on May 27 2010 13:20 EDT "package does