This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Problem running code while using interfaces/polymorphism

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Ubuntu Linux

I have three simple classes in a folder named one that is located in another folder:

Movable.java



Automobile.java



and Application.java



Whenever I run main even after compiling everything I get the error:



I have tried a multitude of solutions including messing with CLASSPATH but I am still getting errors. Honestly, I dont fully understand what I am supposed to point to when defining classpath in etc/profile
 
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We'd need to know a couple of things:
What does your project directory tree structure look like?
What directory were you in when you ran the compile?
Exactly what was the command line you used to compile?
What version of the JDK are you using?
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:We'd need to know a couple of things:
What does your project directory tree structure look like?
What directory were you in when you ran the compile?
Exactly what was the command line you used to compile?
What version of the JDK are you using?



the classes are in this folder:
~/Documents/CS/java/Java_Interfaces/one

I opened the folder in visual studio code on ubuntu linux

I just ran main in visual studio code but I also tried:



that didnt work either, same error after copiling all the files in terminal

openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:How about



I ran that didnt get any output, It just compiled everything and made class files without any errors

then I ran in one folder



 
Carey Brown
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are currently in your "Java_Interfaces" folder



Double check me on the cp, I'm guessing that the linux path separator is a colon but I may be wrong.
 
Ed Palazo
Ranch Hand
Posts: 51
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:If you are currently in your "Java_Interfaces" folder





I got object is moving
 
Carey Brown
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:



lol it keeps showing some emoji but you meant this:



?
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:

Ed Palazo wrote:I got object is moving


Congrats!



oh yea lmao thats supposed to be my output right lol

but yea howcome visual studio code just doesnt group them on its own even when they are in same project folder?
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:Not familiar with Visual Studio, sorry.



ok.  Thanks for your help!  really appreciate it.

Whats the best ide for working with multiple classes in linux?  I dont like eclipse, it uses too many resources on my computer and I dont like the whole folder setup
 
Carey Brown
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Carey Brown
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was a  Java consultant for 25 years and _every_ company I worked for used Eclipse. Mostly, I really like Eclipse. The rest I've learned to live with. Oh well.
 
Marshal
Posts: 25215
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ed Palazo wrote:Whats the best ide for working with multiple classes in linux?



If you have only one class then there isn't much point in using an IDE, right?

What I'm trying to say is, all of them are designed to handle more than one class at a time.
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:I was a  Java consultant for 25 years and _every_ company I worked for used Eclipse. Mostly, I really like Eclipse. The rest I've learned to live with. Oh well.



lol nice, I see.  
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Ed Palazo wrote:Whats the best ide for working with multiple classes in linux?



If you have only one class then there isn't much point in using an IDE, right?

What I'm trying to say is, all of them are designed to handle more than one class at a time.



you have a point.  
 
Carey Brown
Saloon Keeper
Posts: 6939
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At one point I hit a frustrating bump in the road (years ago). So I tried NetBeans. I found it to be much worse so I went back.
 
Paul Clapham
Marshal
Posts: 25215
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's true that Eclipse is like a Swiss Army knife with a thousand blades, though.

I suggest looking at Choosing your Java IDE for suggestions. Scroll down to the part headed "Lightweight Java IDEs" and read on from there.

(Let me just note that from what I see at this site, BlueJ leads you to write weird code and when you come here to ask questions, people won't quite understand what you're talking about. My opinion.)
 
Marshal
Posts: 68115
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ed Palazo wrote:. . . I ran that didnt get any output . . .

Always interpret, “no output,” from javac as, “worked correctly.”

Paul: I have used BlueJ. A long time ago,, so I no longer have nightmares about it. It allows you to compile code and run part of it, but isn't at all happy with package names.
 
Saloon Keeper
Posts: 11488
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally I'm a huge fan of NetBeans and I generally don't touch Eclipse unless I'm helping people with an Eclipse problem. After all these years Eclipse still leaves a bad taste in my mouth.

I hear good things about IntelliJ IDEA, but I've never used it myself.
 
Campbell Ritchie
Marshal
Posts: 68115
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use an IDE I usually use Eclipse, partially because it is what I am most familiar with. As far as I can see, all three well‑known IDEs are good. I don't think BlueJ is really an IDE like those three. It is specifically designed to allow people to experiment with objects and methods. Which works, but if you use it for deeloping applications of any size, it turns into Fred's hammer to put screws in with
 
Ed Palazo
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setup eclipse on my linux machine and it worked easily with the same classes.  I just dont like its structure/look.  idk maybe its just me.  
 
Campbell Ritchie
Marshal
Posts: 68115
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ed Palazo wrote:. . . I just dont like its structure/look. . . .

Maybe youi can change he look. Or maybe you'll be happier with NetBeans or IntelliJ.

idk . . .

Surely yoiu mean ide? No, it's a different abbreviation. Please avoid such abbreviations, etc.
 
Oh. Hi guys! Look at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!