I am new to Java and this is my essay to pass java. I found a template that I want to test, but the error is too strange for me to understand.
I must work in Netbeans ID 13 and the picture shows it all. But to me... I have the idea that I have everything on the same place. See here
I hope someone can help me to get on the right track.
Make sure the package and the directory names are both in lowercase. So 'com.mycompany.test1' not 'com.mycompany.Test1'. If the java source files are in the same package, then an import is not needed.
There might be something wrong within Options.java too. If so, please share the source code of it.
Related
Im new with Java and i'm struggling with packages and classes when it comes to imports.
So i want to do something simple :
I want to include my class that takes inputs from the user, but somehow it keeps giving me all sorts of errors.
In Java, to be part of a package, you both need to be inside the correct folder, and start the file with package myclass;. You didn't show us the source code for Clavier.java but my educated guess is that you didn't start it with package myclass;.
As a side note, myclass is a really bad and confusing name for a package (which isn't a class).
I don't understand why is this happening, but as soon as I click "Aceptar" Eclipse minimizes and is impossible to work on that way. It started happenning since I started renaming some components but I don't think this could be a problem, wouldn't it? Does any of you know why this happens? Because I need to finish this project for an exam and I still have lots of things to do. Thanks in advance
you renamed your components, what do you mean?
Did you change class names? Did you change filenames?
If one of the above is correct you should refactor the names.
Classname must be identical with your file name.
If it isn't the case you ought to post the code that you have changed, which caused the ongoing problem.
:) have a nice day
I'm reading a book right now, Its called: "Introduction to Compiler Construction in a Java World". So from their website you can download the source code of the compiler that one must use. -> http://www.cs.umb.edu/j--/download.html My problem is that I would like to follow the process of the compiler through debugging. But it doesnt work, because you have to attach the source code, which I tried, but it doesnt seem to work. I attached class files, java files, the jar, nothing works. So does someone know how to fix that problem?
Edit1: In eclipse
Edit2: Maybe this helps to understand my Problem better-> http://postimg.org/image/9pd2gyle7/
I wanna see what happens in the compiler process. But I cant see the main class, even though I have the main source code :S
When you say, you did attach sources, make sure to define a source attachment in a way that Eclipse understands. If that's what you tried, more information would be necessary to tell why it didn't work.
OK I give up. I've been trying to do this for the past two hours I googled how to add external source to eclipse, how to import, how to add to build path etc. and I must say there is absolutely nothing that clearly states how do you do this.
I want to add a directory with some Java classes. I downloaded it from github. It has a package some.package.name in its header.
I tried drag and dropping it to my project, adding it via build paths, using the import button. I tried changing the package names.
I always get this "RED X" icon next to the folder names ( these folder names are called like the package string in the headers ). This isn't even annotated so I do not know what am I even doing wrong. Why doesn't eclipse accept these sources? They are already in the project tree I do not understand this.
Can somebody actually tell me how you are supposed to do this? And why is this so complicated? Why would people create a IDE with I suppose a million lines of code and then make it be so hard to do the simplest thing?
Sorry for the rant but I am seriously starting to hate Java.
Tried to google but got hundreds of unrelated issues regarding testing. I guess I'm missing a crucial keyword to reduce the number of hits to something that is relevant for me.
I have a class in src/test-integration/java which i need to run, since it is a tool for extracting test data from an database. It's basically just a little script in the main method.
However when I try to "run as java application" in Eclipse it says: Error: Could not find or load main class x.y.z.MyClass
I know it has worked before, but not sure how I got it to work.
Sorry for any missing information, please feel free to ask for more.
Any ideas of what I'm missing?
Added the whole full path to the java class in the Java Build Path properties in Eclipse and deselected "allow output for source folders" and selected it once again (don't know if that did something, but I include it anyway).