The Artima Developer Community
Sponsored Link

Java Answers Forum
classes

2 replies on 1 page. Most recent reply: Mar 2, 2002 7:04 PM by Charles Bell

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 2 replies on 1 page
des

Posts: 4
Nickname: des
Registered: Mar, 2002

classes Posted: Mar 2, 2002 6:42 AM
Reply to this message Reply
Advertisement
how am i going to call a java class from another java file/code?
i already imported the class but the code returns a "cannot resolve symbol" error when compiled...


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: classes Posted: Mar 2, 2002 12:47 PM
Reply to this message Reply
Unless the other class is in a specific package, then you don't need to import anything (it will be in the default package). Maybe if you post your code (and use the [java] tags!), we can offer more specific help...

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: classes Posted: Mar 2, 2002 7:04 PM
Reply to this message Reply
The other class needs to be in your CLASSPATH.
You may eed to consult the documentation for your particular java development kit installation and modify your CLASSPATH.

Or when you compile you can add the other classpath inside the javac command

if your other class is at:
C:\j2sdk1.4.0\projects\MyOtherClass.class
then you can add this into to the javac compile statement with

javac -classpath %CLASSPATH%;C:\j2sdk1.4.0\projects\MyOtherClass.class ThisClass.java

Flat View: This topic has 2 replies on 1 page
Topic: Java Previous Topic   Next Topic Topic: Applet Reading file froom Client m/c and coiping to server machine

Sponsored Links



Google
  Web Artima.com   

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