• 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

JDK Installation Question

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to compile java programs and all of my import statements are greeted with: Cannot resolve symbol
Any ideas?
Thanks!
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
post some of the code so i can take a look at what you are doing
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
very simple little program:
import java.io.*;
import java.util.*;
public class HelloDate {
public static void main (String[] args) {
System.out.println("Hello, it's: ");
System.out.println(new Date());
}
}
both import statements fail on compilation
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ar eyou sure its an import problem?
it compile fine by me but i got a run time error
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah, i think so. for both import lines it points at either the "io" or the "util" and says "cannot resolve symbol". i was thinking it might be in my classpath or something but it all looks good to me.
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Find out where your jdk directory resides. For me, it's c:\jdk1.3.
Add the c:\jdk1.3\jre\lib\rt.jar to your classpath, or when you execute the javac, add -classpath option.
-Peter
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter, I have that in my classpath as well. It isn't the source of this problem. Thanks anyway!
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update. Using the -classpath statement does work, but shouldn't it work if i have that path in my classpath?
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
make sure both the clsspath and the path are set
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman,
It should. If you're using W2K or NT, type:
echo $CLASSPATH at a cmd prompt. You should see rt.jar somewhere on the output. If you don't, then it's not in your CLASSPATH.
If using the -classpath options works, then it's an indication that you do not have the rt.jar in your CLASSPATH environment variable.
-Peter
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter, here's what I have in my classpath
C:\WINNT\system32;C:\WINNT\System32\Wbem;C:\WINNT\Java\Classes\RxAssistant.zip;c:\java;.;c:\jdk1.3\lib;c:\jdk1.3\jre\lib\rt.jar
if i type echo %CLASSPATH all i get back is %CLASSPATH (if i type echo anything all i get back is anything). if i use the -classpath option and type the exact path that i have above for the rt.jar it works. I'm running W2k.
am i missing something simple?
Thanks!
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman,
Try it with a "$" if you're using NT. For example, echo $CLASSPATH.
My bad...My colleague fixed me up. I'm using a bash window under NT, so it's a little different.
If you're just using a regular cmd session, then you'll need to type: echo %CLASSPATH%

-Peter
[This message has been edited by Peter Tran (edited January 12, 2001).]
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whoops. i have % on the brain. (what with tax season coming upon us :-) but when i typed it in i did use the $. my mistake in the above message.
i get $CLASSPATH as the response. if i type echo $PATH i get $PATH as the response. if i type echo asdlfij i get asdlfij as the response.
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman,
See my last post for the correction.
-Peter
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok. did the %classpath% and it showed my classpath. the rt.jar file is in it and i have checked, double-checked, triple-checked and so on the path to it and it is correct. still works if i use the same path in the classpath option though.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman, how are you compiling? That is, are you using a make utility (such as gnu make or ant, which would call javac), or are you typing "javac foo.java" directly on the command line? Can you tell us exactly what you're putting on the command line?
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman,
I'm not sure why you're getting the compile time error on those import statements if the rt.jar is in your classpath. The compiler and JVM should pick them up. My last suggestion is go through the JDK installation process again. Maybe some system variable wasn't set correctly. Uninstall the JDK and reinstall it.
Good luck,
-Peter
 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Susan,
i'm compiling by typing javac HelloDate.java
when i do the classpath i type javac -classpath c:\jdk1.3\jre\lib\rt.jar HelloDate.java which works fine.
Norm
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i tried ur code on my system and didn't get any compile time or run time error.it gives me fine results.i have jdk1.3 and simply set the path in Autoexec.Bat file as c:\jdk1.3;c:\jdk1.3\bin;;
try this.this may help u
Smriti Singla
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also compiled and run the program and it's fine. I got the output.
However my path is:
PATH=c:\windows;c:\windows\command;D:\JDK1.3\BIN;
You can change the path by "set Path=%PATH%;D:\JDK1.3\Bin:" command at the prompt or by directly putting "PATH=c:\...etc".
I think it should help. I suppose the program is not able to find the path so it runs when you type -classpath.

[This message has been edited by Swati Samudra (edited January 18, 2001).]
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Norman,
I think ur problem is more related to a bug in NT rather than any problem in the java compiler. NT can take only a fixed number of characters in it's environment variables. So, just try this
set classpath=c:\jdk1.3\lib\rt.jar;.;
set path=c:\jdk1.3\bin;
I am assuming that ur jdk is in c:\jdk1.3
This should definitely work
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhesh,
I don't know about that environment variable limit thing. I have a heck of a long PATH in NT, and I have no problems.
PATH C:\jdk1.2.1\bin;c:\jdk1.2.1\RelTrak;\c:\ora8;D:\ORA8\bin;C:Program Files\Oracle\jre\1.1.7\bin;\d:\IBM Connectors\Encina\bin;d:\IBMJava\hpj\bin;D:\IBMVJava\eab\bin;C:WINNT\system32;C:\NET\VIRUS\INOCNT;C:\Program Files\Personal Communications;D:\ORANT\BIN;;C:\WINNT\System32\WBEM;D:WINNT\System32\WBEM;
CLASSPATH=c:\jdk1.2.1\RelTrak;c:\jdk1.2.1\bin;
Of course I put my java stuff at the front of the path by using a bat file:
p.bat
PATH C:\jkd1.2.1\bin;c:\jdk1.2.1\RelTrak;c:\ora8;%PATH%;
set CLASSPATH=c:\jdk1.2.1\RelTrak;c:\jdk1.2.1\bin;
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My compiler wasn't recognizing the parse.Double() method. I'd seen it in the 1.3.0 API so I was confused. Now I figured out that although I have SDK 1.3.0, somehow an old version of the compiler is being used. How can I install the 1.3.0 compiler? Or, rather, since I already installed it how can I get IT to be used instead of whatever older one I have also?
Any help would be much appreciated.
DJ
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your path is still pointing at the old version, that's where it will compile. If your CLASSPATH is still pointing at the old version, that's where it will run.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please set the path for the entire java application.
For ex: if the java is installed on the C;\jdk1.2\bin
just check out for the path like typing the command 'path'
if it is not correct type PATH=C:\jdk1.2\bin
Then recompile u r program.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
even i have problems in setting the path and compiling programs.
i have downloaded java 1.3 from the net and win 98 upgraded to win 2000. earlier with java 1.2 i could do it in another computer!!!
can somebody help in setting the path
thanks a million
venkat
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norman,
raj may be right.there is a problem with u'r system.
faced exactly the same problem a few months back.
The problem is that the * symbol is not being recognised.or some unprintable character is there.
the fact that some other program (assuming it was quite old)is still running, indicates that there is nothing wrong with the current program and path and classpath settings.
The program should work by doing the following
1) change the font u were using
2) retype the program with a different font
3) save the file in a different drive.

Originally posted by Norman Leach:
Susan,
i'm compiling by typing javac HelloDate.java
when i do the classpath i type javac -classpath c:\jdk1.3\jre\lib\rt.jar HelloDate.java which works fine.
Norm


reply
    Bookmark Topic Watch Topic
  • New Topic