So I just installed Eclipse on my computer, which I just got a new hard drive for, and I have this weird problem. I installed the JDK, and eclipse, and got it up running and looked at my screen. The first thing I saw was like a million errors that weren't there on my other computer. But when I ran the code, it still works perfectly fine.
Here is a picture
Right-click on your project folder "Build Path" -> "Configure Build Path" then choose tab "Libraries". Ensure your JRE System Library is set correctly. If set, you can double click on it and check it's configuration if not, press "Add Library" choose "JRE System Library" and proceed accordingly.
Related
I was programming a fabric minecraft mod in intellij and when I ran the code it said :
Could not find or load main class net.fabricmc.devlaunchinjector.Main
When I compiled the code and tried it in minecraft it worked, but in intellij i couldn't run it.
I was messing around with the files, to see if I can fix it and I found a solution :
Go to "Run Configuration", press the arrow to see the options and tap "Edit
Configurations"
Go to "Minecraft Client" and press the button next to
"net.fabricmc.devlaunchinjector.Main"
search trough your external libraries and find "net.fabricmc.devlauncherinjector.Main"
(it must be right under net.fabricmc-api...) select it, and after that you should see
the "Edit Configurations" window. Press "OK"
If this doesn't work, right click the file and select "Copy Full Path". Then go to
"Edit Configurations" window and paste it where it says
"net.fabricmc.devlauncherinjector.Main"
If the 2 option doesn't work either, close the project, copy the mod folder, and paste
it somewhere else(eg. Desktop, New Folder). And then open your IDE, go to open project
and select the copied folder. Press the "Build.gradle" file and select open as project
and "Trust" .It should now work. If it doesn't , unfortunately I don't know how to fix
it.
thecoopsyt's answer worked for me.
Go to Gradle tab > Reload All Gradle Projects
Wait a few mins for it to check and update your dependencies.
After this I was able to return to testing my project in Intellij... had to fully compile and test before this fix.
In Intellij gradle if
this doesn't work you can put
downloadAssets runClient into a gradle config and it will start a client and download the net.fabricmc.devlauncherinjector.Main
this allows you to use gradles built in Minecraft Client
Does anyone know of any complete guide that shows how to reconfigure from scratch the "Build Path" in Eclipse?
In the attempt to add a .jar file I messed up the current configuration. Or if you think volunteering pictures of your Eclipse config screen may help, that would be appreciated it too!
I hope I will not have to reinstall Eclipse.
The error I keep getting (for any classes, also those who used to run perfectly) is: "Editor does not contain a main type." (BEFORE any program even LAUNCHES).
I had deleted JRE but then I put JRE back by right clicking the root of "package explorer" - Build path - Add libraries - JRE System Library. Still same error.
The "Build Path" -> "Configure Build Path" tool can be used to fix a lot of problems that other build path modifying techniques can cause.
Open that tool and look through the tabs and see if you can find the entry that is causing the problem. Pay special attention to the Libraries tab. You may just want to remove all the entries in this tab and re-add the ones you need one by one. Build path problems are often broken entries in this tab.
You might also try looking through "Run" -> "Run Configurations" tool and remove any run configurations associated with the project.
I didn't have any source folder added in the Build path configuration. I just went to Build Path configuration and added the folder in the "Source" panel. (I had previously deleted it by mistake.)
This solved my problem, now my applets and console classes run perfectly like they used to.
http://zenverse.net/editor-does-not-contain-a-main-type-error-in-eclipse/
today I got a strange problem while trying to call a batch file from Eclipse IDE.
The setting for a normal user is:
Call a .bat file
This sets some environment variables
And calls a Eclipse RCP application
The setting for my program is:
Call the same .bat file via Runtime.exec()
When calling it as normal user, all works well, the RCP gets started.
When calling it within Eclipse IDE via Runtime.exec() I get an error message complaining that Program Files\jre6\bin\server\jvm.dll could not be found (although it is there).
When exporting my program as an executable .jar file, it works well like I would click on the .bat myself.
What is the difference? (Operating system is Win7)
In Eclipse,
Right click on the project and click "Properties".
Select "Java Build Path".
Select "Libraries" tab.
Select "JRE System Library" and click "Edit".
Check if the System Library points to a valid JDK installation(not JRE). If it doesn't point to a valid JDK installation.
Select "Alternate JRE" and click on "Installed JREs"
Click on Add, point to valid JDK installation and click OK.
In "Alternate JRE" drop down, select the newly added valid JDK and click Finish.
Run the program and check.
Ok got it.
It seems to be a specific problem of Eclipse 3.7.
After installing 4.2 all works perfectly well.
I'm doing this for a project in AP Computer Science.
Basics:
Mac OS X 10.5.8
NetBeans 7.0
Android SDK 3.0 (Level 11)
So I'm trying out some of the Android API Demos in NetBeans (I prefer it over Eclipse) and I'm using samples\android-11\ApiDemos\ for the source. The R.java file is not generating and "package R does not exist". I've looked at other answers, and they say to Clean and Build the Project, but that option is grayed out in NetBeans (so are just the "Clean" and "Build" options). Any ideas on what I should try before I switch to Eclipse? I also have a computer running Windows 7 if I need to change the OS. Thanks!
Right-click your project and hit build. It will generate the missing R class for you. At least it did for me in Netbeans 7.1
Just right-click on the project, select the "Update broken project" command, then "Build" is not gray no longer. Build it, OK!!
The right-click menu command
I had the same problem, but all I did was a "Clean and Build", and then the R file was created by Netbeans (running 7.1).
I had to run netbeans as administrator on my Windows 7 pc before it could build the R file. If you're saving the project to somewhere "secured", make sure that Netbeans gets all the neccessary rights to read/write/edit that location
Get Android plugin for NetBeans and then you will be able to open these project and play with them. The project home page is http://www.nbandroid.org/
Some initial steps may be needed. Set up SDK location in Tools | Options | Misc | Android. Then check that your project has some build target set in (select project, r-click and go to project properties). Once the build target is set plugin will (re-)generate build script and required .properties files. You'll be able to run build then.
-Radim
Several things could be going on, but what happens to most people is:
an error makes R not build
R is unknown, they try to fix the error by importing packages
There is now a "import R.id" or something in the java files
...
Loss
Also, it could just be point one, that a problem with the setup (manifest broken, wrong project props, or something like that) make R not generate, and then you won't have R.
But really, I've seen some examples of people doing point 3.
I had the same problem and it was due to the package of R not being the same as the one for Main. I just moved Main to the same package as R and everything is fine after I hit Build.
In my case adb was missing.After installing adb everything worked fine.
You can just right-click the project and choose build from the context menu.
(This works for me. I am using NetBeans 8.1)
I'm trying to debug a program that calls a function in the HashSet class, but I get a message saying: Source not found. I know this is something with not finding the library files. Please, can someone guide me to how I can set it up? Which library files should it be pointing to?
Thank you very much for any pointers.
Finally got around to doing this awhile ago and I love it.
First you need to download the Java source. I got mine here (look for "Java SE 6 JDK Source Code"): http://www.oracle.com/technetwork/java/javase/downloads/index.html. Download that and stick it somewhere on disk that you can find easily. Keep in mind that the JAR you download has to actually be "installed" somewhere via you agreeing to a license agree (extract it with jav xvf jarname.jar and check the README it contains).
For any JAR file on your CLASSPATH in Eclipse, you can add a source attachment to it to point to its source code. The easiest thing to do is bring up the Package Explorer view. Underneath your project, you should see an item for your Java Runtime Environment (JRE) (mine is called "JRE System Library [JavaSE-1.6]"). Click on the expansion arrow for that and you'll see a list of JARs.
Most all of the Java classes you'll care about viewing are stored in "classes.jar". Right-click on that JAR and select "Properties". In the left hand menu, select "Java Source Attachment". On the right side, click "External Folder" and find the source code that you downloaded and installed and put that folder into the "Location path" field. Hit "Apply" and "OK".
Now you should be able to right click on any built-in Java class in your code and use the "Open Declaration" command or when debugging you will now step into the Java source.
It's a great capability to have. Enjoy!
HashSet is in JRE Package, so you can download JDK source and attach it into eclipse.
An other way, when you can not find out the source package, you can use JD-Decompiler
which has eclipse plugin to decompile your class, it work and show most like original source file.
Choosing a JDK instead of JRE for the runtime environment worked for me!
NOTE:Make sure you have a JDK installed and not only JRE before proceeding.
Remove the current system JRE library:
Right Click project -> properties -> Libraries -> Remove current JRE Library.
Add other installed library to your project:
In the current dialogue box, click "add library". by default JRE system library is selected, if not, select it and click next. now select "Alternate JRE" and click "Installed JRE". In the new dialogue box, click search and provide the path to your installed Java environments.
Finalize
Select an installed JDK, and click OK. Click FINISH and again OK to proceed.
Abdul,
The best way is as the others explained to download the sources and attach them in the eclipse.
The EASIEST way would be installing the java decompiler (JAD). Take a look at http://jadclipse.sourceforge.net/install.html. Its explained there in 4 super simple steps :)