Greg Charles wrote:Hi Catalin, welcome to Java Ranch!
If all the Java files are in the same directory, the easiest thing would be just to compile them all at once. Like:
javac *.java
Greg Charles wrote:
Also, I have to ask what word you translated into "carpet"? I hope it's clear I'm asking out of curiosity, not pettiness. I think the word you meant was directory or folder, but I'm not completely sure.
Catalin Dumitrache wrote:
You are right, I ment directory, my English is very bad, sorry for that xD
Liutauras Vilda wrote:Hi,
Lets start over.
1. How many files do you have in the directory where you executing "javac *.java" command?
2. How the files are named? How your classes are defined within your files?
3. How many defined classes do you have per source (.java) files?
4. Does your classes contains any "package" statements?
Greg Charles wrote:
Catalin Dumitrache wrote:
You are right, I ment directory, my English is very bad, sorry for that xD
Well, it's a lot better than my Spanish! Anyway, I wasn't trying to criticize. I just found that an interesting substitution, like maybe there's a Spanish word that means both directory and carpet. I'm weirdly fascinated with languages.
Greg Charles wrote:I'm surprised javac * didn't work for you, but Liutaurus brings up some good points. I can't actually think of a scenario where all the java files are in the same directory, but the compiler fails that way, but if you give us some more information, we can probably figure it out.
Baraja.java:50: cannot find symbol
symbol : variable Main
location: class practica1Java.Baraja
indice=Main.rand();
Liutauras Vilda wrote:
Baraja.java:50: cannot find symbol
symbol : variable Main
location: class practica1Java.Baraja
indice=Main.rand();
1. Check Baraja class and show us, how did you create and instance of your "Main" class?
2. Does your "rand" method has "static" non access modifier?
3. Did you recompile that class? "location: class practica1Java.Baraja" as it seems it is packaged (you mentioned it is not)
Campbell Ritchie wrote:If that class Partida has a package name, try copying it into the same directory as all the other .java files and removing the package name.
Also show us the result of printing the contents of the current directory with ls (Linux) or dir (Windows). Be sure to use copy‑and‑paste so we can see any spelling errrors.
Campbell Ritchie wrote:If you have to use the -cp option, then the problem is not solved. It suggests you have set a system CLASSPATH, which is usually a bad idea and usually does more harm than good. Older books tell you how to set it, but it is not necessary any more. Please show us the contents of your CLASSPATH with this instruction:-
echo %CLASSPATH%
Campbell Ritchie wrote:I thought you were using a Windows box, which is why I said %CLASSPATH% rather than $CLASSPATH.
Where did you declare that CLASSPATH? Was it in .bashrc or similar?
Why have you got it in the first place?
O good grief! It has Oracle in. Have you installed an old version of Oracle? Oracle used to be notorious for changing the system CLASSPATH while you weren't watching.
You will probably not have the GTK module line. The # is a bit like // and must be applied to each line.PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export GTK_IM_MODULE="xim"
# Removed 8th August 2015 because oracle classpath unnecessary
# CLASSPATH="/usr/local/oracle/app/oracle/product/9.0.1/jdbc/lib/classes12.jar:/usr/local/oracle/app/oracle/product/9.0.1/jdbc/lib/nls_charset12.jar:/usr/local/oracle/app/oracle/product/9.0.1/jdbc/lib/ocrs12.jar"
Don't get me started about those stupid light bulbs. |