The Artima Developer Community
Sponsored Link

Java Answers Forum
compilation error

5 replies on 1 page. Most recent reply: Dec 12, 2003 3:35 AM by Sunitha C S

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
maxima

Posts: 15
Nickname: maxima
Registered: Nov, 2003

compilation error Posted: Dec 10, 2003 4:42 AM
Reply to this message Reply
Advertisement
hi i was compiling a java source code but getting some error....

$ javac JEncode.java


JEncode.java:5: '.' expected
import GrafixTools; //i have a code named GrafixTools.java
^
JEncode.java:7: class JEncoder is public, should be declared in a file named JEncoder.java
public class JEncoder extends Frame
^
Note: JEncode.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
2 errors


i donot understand these errors....can u suggest how to remove this???


Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: compilation error Posted: Dec 10, 2003 8:52 AM
Reply to this message Reply
If your class GrafixTools is in the same package as the current class, i.e. JEncoder then there is no need to use the import command. Java will find it. So you can remove that line.

Your class is named JEncoder and your file name should be named JEncoder.java too. Currently it is named JEncode.java - note the missing r at the end.

Adam

maxima

Posts: 15
Nickname: maxima
Registered: Nov, 2003

Re: compilation error Posted: Dec 10, 2003 10:31 AM
Reply to this message Reply
yes i changed accordingly.... the two error has gone....

but the last error....

" Note: JEncoder.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details. "
.....is still there
what is the meaning of this???????

Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: compilation error Posted: Dec 10, 2003 10:40 AM
Reply to this message Reply
In your JEncoder class you are using some methods that have been deprecated. A "deprecated method" means its use is not recommended. It may be replaced by a better method. If you compile your JEncoder.java file:

javac -deprecation JEncoder.java

then the compiler will point you to the exact method calls that have been deprected. If you still want to use those methods then you need not worry about the error you are getting. In fact, they are just notes or warning and not errors. Your JEncoder.java has compiled fine and you can use it. If you want to replace those methods then see the JDK documentation for those methods and there you will find some help.


Thanks
Kishori

maxima

Posts: 15
Nickname: maxima
Registered: Nov, 2003

Re: compilation error Posted: Dec 10, 2003 10:59 AM
Reply to this message Reply
thanks

Sunitha C S

Posts: 20
Nickname: sunics
Registered: Dec, 2003

Re: compilation error Posted: Dec 12, 2003 3:35 AM
Reply to this message Reply
hi,

the first error is because of the file being in another package. there u have to give the full package specifier to the file.

second is because that u have ur file name as JEncode.java and it is having a PUBLIC class with the name JEncoder. since java has a rule that the file name should be the name of the PUBLIC class, it cant have more than one public class. so put the second class either not PUBLIC or in another file.

third is a warning to show u that some method u used in the file is having a better alternative. so compile as javac -deprecation JEncode.java so that it will give u which method is having a better alternative.
best of luck

sunitha

Flat View: This topic has 5 replies on 1 page
Topic: little help please.  i am sure u could do it in secs. Previous Topic   Next Topic Topic: Human database terminal program

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use