Win a copy of Rust Web Development this week in the Other Languages forum!

Atreo De Maio

Greenhorn
+ Follow
since Nov 28, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Atreo De Maio

Hi!

Ok, let's go through it.
I've done changes following your suggestions.
I have a folder called 'estructuras' which has three files:
Punto.java
PuntoI.java (interface)
Punto2Di.java (implementation)

When I compile 'Punto2Di.java' outside 'estructuras' folder:

----jGRASP exec: javac -g D:\Universidad\2_Edi\2005-2006\Punto2Di.java

Punto2Di.java:13: cannot access estructuras.PuntoI
bad class file: .\estructuras\PuntoI.class
class file contains wrong class: PuntoI
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Punto2Di implements PuntoI
^
1 error

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

And when I compile 'Punto2Di.java' inside 'estructuras' folder:

----jGRASP exec: javac -g D:\Universidad\2_Edi\2005-2006\estructuras\Punto2Di.java

Punto2Di.java:1: package estructuras does not exist
import estructuras.*;
^
Punto2Di.java:13: Punto2Di is not abstract and does not override abstract method Distancia(PuntoI) in PuntoI
public class Punto2Di implements PuntoI
^
Punto2Di.java:22: construir(double,double) in Punto2Di cannot implement construir(double,double) in PuntoI; attempting to use incompatible return type
found : Punto
required: void
public Punto construir(double X, double Y)
^
Punto2Di.java:24: cannot resolve symbol
symbol : method Punto (double,double)
location: class Punto2Di
Punto(X,Y);
^
Punto2Di.java:47: cannot resolve symbol
symbol : method Abcisa ()
location: class Punto
distancia = ( Math.pow((abcisa - puntoAux.Abcisa()),2)
^
Punto2Di.java:48: cannot resolve symbol
symbol : method Ordenada ()
location: class Punto
+ Math.pow((ordenada - puntoAux.Ordenada()),2) );
^
6 errors

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.


Long ago I tried to set my PATH and CLASSPATH for compiling from the command line wherever in my hard disk. As I didn't achieve it I downloaded jGrasp because I can compile files in other folders than ...\bin

Thanks a lot.
I only can say thank you and try.
Thank you very much
15 years ago
Sorry, I haven't written al the lines the compiler shows me about the error.
Here they are:

----jGRASP exec: javac -g D:\Universidad\2_Edi\2005-2006\estructuras\Punto2Di.java

Punto2Di.java:1: package estructuras does not exist
import estructuras.PuntoI;
^
Punto2Di.java:13: cannot access PuntoI
bad class file: .\PuntoI.class
class file contains wrong class: estructuras.PuntoI
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Punto2Di implements PuntoI
^
2 errors


Help me please.
Thanks a lot
15 years ago
Hi again Keith and Layne!!

I think I've done some progress...

I've writen the class 'Punto' and the interface 'PuntoI' inside a file called 'estructuras.java'.
When I compile two files are generated: 'Punto.class' and 'PuntoI.class'.

But I'm still trying with my other friend 'Punto2Di.java'. It doesn't compile due to this:

Punto2Di.java:1: package estructuras does not exist
import estructuras.*;
^
Punto2Di.java:13: cannot access PuntoI
bad class file: .\PuntoI.class
class file contains wrong class: estructuras.PuntoI

I have another change to tell. Now the folder where these files are is called as the package 'estructuras'.

Maybe the error is because I have to include the package somewhere or I have to specify by the CLASSPATH or PATH variables.
I'm still very very new to these parameters and variables, but I'm trying...

Am I right?
Any suggestion?

Thank you very much for your help it's being great.
15 years ago
Hi Layne Lund, thanks a lot for your answer!

Maybe it's due to in 'Punto2Di' (the one than implements 'PuntoI') I've writen import Punto.

'Punto' (it's a class), 'PuntoI' (interface) 'Punto2Di' (implementation) have in the first line this sentence:

package structures;

In the folder I only have these files:
'Punto.java' (and 'Punto.class')
'PuntoI.java' (and 'Punto.class')
'Punto2Di.java'

Should I write: 'import structures.PuntoI' ?

Has my error anthing to do with that?


Thanks for your help
15 years ago
Hi!

Thank you for answering

I don't know my CLASSPATH because jGrassp does everything for you.

And yes, the *.class files are there: 'Punto.class' and 'PuntoI.java'.


Any idea?
15 years ago
I have that error and I don't know what else I can try.
The situation is the following:

'PuntoI.java' is an interface.
'Punto.java' is a class.
'Punto2Di.java' pretends to be an implementation of 'PuntoI.java'

----jGRASP exec: javac -g D:\Universidad\2_Edi\2005-2006\PrJAVA\Punto2Di.java

Punto2Di.java:13: cannot resolve symbol
symbol : class PuntoI
location: class estructuras.Punto2Di
public class Punto2Di implements PuntoI
^
Punto2Di.java:22: cannot resolve symbol
symbol : class Punto
location: class estructuras.Punto2Di
public Punto construir(double X, double Y)


Any idea of the solution?

Thank you very very much for your attention and help.
15 years ago
Hi there!!

First of all, THANK YOU VERY MUCH for answering.

The thing is that none of the suggestions worked and I don't know why. This is becoming in the typical annoying fly...

Any other suggestion? Maybe I have to install something else?
16 years ago
Hi everyone!!

Please, help to set up my classpath variable. I know I know I have guidelines in API but I don't achieve it, I'm so clumsy.

I've formated my hard disk and installed everything again, but the classpath is wrong because I can't compile my java files.

I've tried with this:

C:\Program Files\Java\jdk1.5.0_06\scr.zip;C:\Program Files\Java\jdk1.5.0_06\javac.exe;C:\Program Files\Java\jdk1.5.0_06\java.exe

I've also tried with the same lines but unnaming files (finishing with '\')

What am I doing wrong?

Thank you very much for your attention and help.
Merry Christmas and Happy New Year!!

And I hope the Three Wise Men bring you everything!!
16 years ago
Hey!

Thanks a lot to everyone!!!


I'm going to try your suggestions.


Thank you for your help.

Bye
16 years ago
Hi everyone!!

Thank you for reading me, I need your help.
I'm new (very very new) in JAVA programming.

I have a problem. I'm trying to write an application that reads a couple of
numbers (double). It shows a message on screen that says something like
'type a number', and then it reads it.

The thing is that the program doesn't stop for the input of the second
number and I don't know how to solve it.

Can you help me please?

My code is similiar to the following one:

System.out.println("Type the first number: ");
try{
x = System.in.read();
}catch(IOException e){
System.out.println("It didn't work.");
}

System.out.println("Type the second number: ");
try{
y = System.in.read();
}catch(IOException e){
System.out.println("It didn't work.");
}
// We build the point
Point point1 = new Point(x,y);


Thank you very much for your attention and help.
16 years ago