File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Acess Modifier Error?

 
Lewis Mayer
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two classes
TryStar.java &
Star.java in the package
package com.myself.SWING.TryStar;

TryStar.java has ------->


and Star.java has -------->

when I complie TryStar.java I get the error:

TryStar.java:13: cannot resolve symbol
symbol : class Star
location: class com.myself.SWING.TryStar.TryStar
Star application = new Star(points);

I SEE NO REASON WHY I CANT ACCESS STAR CLASS FROM HERE. ITs a PUBLIC class and in the same package!! Anybdy any ideas??
[ May 08, 2005: Message edited by: Manonthemoon sam ]
 
Shyam Prasad Murarka
Ranch Hand
Posts: 209
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error is caused because the path to your package may not be specified in the classpath. To specify your package in the classpath do one of the following:

For setting temporary classpath:
javac -classpath com.myself.SWING.TryStar TryStar.java

Note: While setting this classpath make sure that your current directory is one level higher than the com folder.

For setting the classpath permanently(in Windows XP):

Right-click My Computer>>Properties>>Advanced>>EnvironmentVariables.

Then in System Variables search for the variable with name "CLASSPATH".
  • If its there then Edit it to include your classpath. Don't erase the other values. Separate your value from the others by a semi-colon. Click on OK thrice.


  • If its not there then click on New and set the name as "CLASSPATH" and the value as the path to your package. (Give the absoulte path)


  • Hope this helps.
     
    Shyam Prasad Murarka
    Ranch Hand
    Posts: 209
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The above post might not be the answer. I guess you just forgot to import the package.
     
    Shyam Prasad Murarka
    Ranch Hand
    Posts: 209
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The above post might not be the answer. I guess you just forgot to import the package.
     
    Lewis Mayer
    Greenhorn
    Posts: 9
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    import the package for wht?
    The 2 classes are in the same package and it is mentioned as the first line of each class. So is there any need to import??
     
    Shyam Prasad Murarka
    Ranch Hand
    Posts: 209
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    As far as I can remember I think you have to import com.myself.SWING.TryStar.* Why don't you give it a try? And please let me know whether it works or not.
     
    Lewis Mayer
    Greenhorn
    Posts: 9
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    its the same error. importing too doesnt wrk.
     
    Henry Wong
    author
    Marshal
    Pie
    Posts: 20836
    75
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    There is no need to import if they are both in the same package.

    Take a peek to see if the compiler actually compiled all the sources.

    Henry
     
    Lewis Mayer
    Greenhorn
    Posts: 9
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Exactly. Thts wht i was saying. And I did compile all sources. Jst beats me hw it's giving an error!
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    What is the exact command you use to compile the sources? From which folder do you compile? What does your classpath look like?
     
    Neeraj Dheer
    Ranch Hand
    Posts: 225
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hey Java Man!!

    apart from answering your query...you will most probably be asked to change your name according to the naming policy...

    <first name><space><last name> and let them be believable first and last names...
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic