incon class java iin eclipse is different [duplicate] - java

This question already has answers here:
Why do my java files look strange in Eclipse?
(5 answers)
Closed 1 year ago.
I have two class .java but in pdcController.java I cannot do anything:
Look the image:
Look the icon are different in BandoService works all, but in .pdfController I cannot do anything (for example I cannot suggest for method or error import). pdfController and BandoServiceare in the same project.

This is not the source file, check the file path, you're probably not in the correct package.
I guess you have several modules in your maven project and you opened the file from the parent module.
If you see the file only in the parent module it's time to git fetch.

Related

Issue with conflicting Java packages [duplicate]

This question already has answers here:
Java: Which of multiple resources on classpath JVM takes?
(3 answers)
Closed 1 year ago.
I am facing some difficulties with this package concept of Java. Let's assume I have the following two directory structures.
dir1
|___com
|___example
|___mypackage
|___myclass.class
dir2
|___com
|___example
|___mypackage
|___myclass.class
So both the myclass.class files are part of com.example.mypackage. Now if both dir1 and dir2 are on CLASSPATH and I write import com.exaple.mypackage.myclass, which path will be considered?
So, It is the responsibility of class loader to load classes. So first of all custom classes have been looked up by the JVM then it goes jar files to check the classes.
In your case it looks like both are custom classes hence to resolve this issue you have specify which file you want to load then you can add dir1 / dir2 to specify the exact class.
JVM picks the latest classes you entered in hierarchy.

Cannot create java file in Intellij IDEA [duplicate]

This question already has answers here:
Problem with IntelliJ -> Cannot create class with name "Main"
(2 answers)
Closed 2 years ago.
I cannot create java class file with name TokenProperties.java. I also tried restart and clean cache but doesn't help. Class with different name I can crate.
Here is error pop-up.
File will added but marked as plain text file, and no java file.
Do you have idea whats is going on? Thank you.
It kind of looks like you create a TXT file with the name TokenProperties.java when you want to create a JAVA file with the name TokenProperties similar to how DemoAAplication was created.
Right click com.example.demoa package.
Select New
Select Java Class
I wasn't able to fix it so I reinstalled Intellij and now it works.

Resource not found on classpath [duplicate]

This question already has answers here:
How to add resources to classpath
(3 answers)
What is a classpath and how do I set it?
(10 answers)
Closed 5 years ago.
I'm on a new branch of a git project on which I've made my own config file called MY_NAME.conf which is located in
Users/myname/IdeasProject/projectName/src/main/resources/config.
However, I'm having some issues getting my branch to run. So, just to make sure things are smooth I set up a new environment and I've cloned into the master. This is all done at
Users/myproject
However, now when I try to run the project I get a message
java.io.IOException: resource not found on classpath:
config/MY_NAME.conf
Why is it looking for this file at all? And even if it is, why is it not finding MY_NAME.conf?
Consider setting the classpath through one of these recommended techniques. Without knowing the specifics of your runtime environment, there should be a mechanism provided to include src/main/resources in your java classpath.
I think the issue is that classpath doesnt include conf folder.
You can modify/set class path with: set CLASSPATH=path1;path2

How do I get the source code to successfully run and compile on Eclipse? [duplicate]

This question already has answers here:
"The public type <<classname>> must be defined in its own file" error in Eclipse [duplicate]
(8 answers)
Closed 6 years ago.
Start. Applet not initialized. My source code doesn't have any "bugs", but I am still unable to successfully run and compile the source code on Eclipse. How do I get the source code to successfully run and compile on Eclipse?
You have a made a common error, often situated with novice Java programmers. You have a class named ConvertCelsiusToFahrenheit, but the name of the file isn't the same. Remember, that one Java class is allowed per file (unless if nested or not public), and the file must have the same name as the class. See the question for why a file must me named as its class

eclipse workspace .location file format [duplicate]

This question already has answers here:
Programmatically list open projects in an eclipse workspace from outside of eclipse
(2 answers)
Closed 6 years ago.
I need a way to get the directory path of an eclipse project by deserializining the .location file found in the eclipe workspace at:
.metadata\.plugins\org.eclipse.core.resources.projects\myproject\.location
Its contents look something like:
#±‹#¼ %–磓¾ URI//file:/D:/proj/myproject ÀXûó#¼ QóŒ{»wÆ
so I would like to programmatically get the "D:/proj/myproject" string out of it.
Bonus points if the process doesn't use the Eclipse API.
Eclipse read this file in the method LocalMetaArea.readPrivateDescription(..).
It uses a SafeChunkyInputStream and DataInputStream for reading it.
It contains UTF8 strings and some integers.
For the complete code see
org.eclipse.core.internal.resources.LocalMetaArea at GrepCode.com

Categories

Resources