문제

Although I'm not new to programming in general, I am new to java, and it seems to work a little bit differently. When trying to compile a .java with javac it gives me this error: cannot find symbol. I looked the cause of this up, and the error occurs when the .class file that you are referencing could not be found. I ensured that all of my references were spelled correctly, I ensured I had the right classpath, I tried compiling a .java file I know is valid, even on an XP computer just in case my Vista installation was the cause, but to no avail. Here are the contents of the .bat I am using to run javac, it could be the cause of my problems.

@echo off
"C:\Program Files (x86)\Java\jdk1.6.0_21\bin\javac" -encoding UTF8 -cp .  hl.java
pause

Thank you for the help, this has been troubling me for quite some time now.

도움이 되었습니까?

해결책

Can you show us this?

I tried compiling a .java file I know is valid

Could it be that you are using classes not compiled on . ? Unless your code is as simple as hello world, I'd say chances are high.

다른 팁

This is a long shot, but looking at your script and the error message you described, you're probably not running javac at all. Try this on the command line and see what it says:

C:\Program Files (x86)\Java\jdk1.6.0_21\bin\javac -version

If that doesn't work, then you're not pointing to a valid javac.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top