• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error in Package

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have following directory structure

F:\java1\new1\Test.java

The code for Test.java is



the second directory structure is

F:\java2\new2\Test2.java

which has the following code


I am compiling the Test.java in the following way

F:\>javac java1\new1\Test.java

and its compiling fine


when i am trying to compile Test2.java which is in java2\new2 package

F:\java2>set classpath.;= f:\java1\new1\Test.java

F:\java2>javac new2\Test2.java

Its showing error message



import java1.new1.*;
^
Test2.java:8: error: cannot find symbol
Test test=new Test();
^
symbol: class Test
location: class Test2
Test2.java:8: error: cannot find symbol
Test test=new Test();
^
symbol: class Test
location: class Test2
3 errors



 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The compiler cannot find Test.class which was generated when you successfully compiled Test.java.

Ensure Test.class is on your class path when you compile Test2.java
 
deepak carter
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to do that sir...i am trying since morning
 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put Test.class on your classpath...not Test.java. Or just put the whole new1 directory on the classpath.

It's also a good idea to specify the classpath right in the javac command rather than setting the environment variable.
 
deepak carter
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac -cp .;C:\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes PropertyExample.java

I am using above path to compile but showing the error



C:\>javac -cp .;"c:\Tomcat 6.0\webapps\jsp\WEB-INF\classes" PropertyExample.java

javac: file not found: PropertyExample.java
Usage: javac <options> <source files>
use -help for a list of possible options
 
deepak carter
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody reply in this...???
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PatienceIsAVirtue.
reply
    Bookmark Topic Watch Topic
  • New Topic