So I'm trying to add jar files to a java project.
I've been told the following:
If you want a more beginner-friendly way of adding libraries, you can
also use the Project Manager for Java extension, which is included in
the Java Extension Pack. With it, you can click the + icon on
Referenced Libraries in the JAVA PROJECTS view, as shown in this
example. A quick tip if you need to add many libraries from a folder
is to Shift or Alt + click the + icon, which will let you select an
entire folder containing multiple .jar files.
After installing Project manager extension and creating a new Java project in VS code, I get to this screen.
As mentioned by VS code, I should be able to see the project view tab after creating my java project. The issue is I don't see the project view tab as shown in the image above. VS code says I should see the 3 dots by the explorer subheading to enable it, but again, I don't have these 3 dots as shown in the first image.
I have both project manager and the extension pack installed, so I really don't understand why I cant see or enable project view.
Any suggestions on enabling project view?
Have you tried to open a java file? Because the extension activated depends on the opened filename extension.
You can refer to here.
If it still does not work, could you provide the OS and the versions of the
VSCode and extensions?
I have struggled quite a bit with this and none of the 'obvious' solutions worked.
The way I ended up solving the issue is by creating a new Java Project and looking at the difference in the config of the files.
Especially in the .project file, there were missing entries. Some also in the .settings/*.prefs files
After updating those in my own project, it got detected properly.
As for the 3 dots, here's what I think: different versions may be slightly different, you see, there are no three points in this one enter image description here. So you may update it when you are free.
As for the project view, you may have to open a project before it appears, Steven-MSFT has said it in detail, you can see it first. If you still have questions, you can provide some details again.
Anyway, you can try the following 2 steps:
open a .java file
reboot your vscode
Related
When I create a new Java project or open an existing one, IntelliJ doesn’t highlight any of the text nor does it suggest anything. All the code is 1 single color. I’ve marked my src file, made sure power safe is off, made sure highlight is enabled, and even reinstalled IntelliJ CE. I’ve also disabled all plugins. Any suggestions is appreciated.
picture here
Your screenshot shows that the file is not recognized as a java source file.
Go to Preferences -> Editor -> File types
Scroll down in the list of Recognized File Types and click Java.
In the list of registered patterns make sure it shows *.java.
Also ensure the file is not marked in the Ignore files and folders section at the bottom of this preferences panel. Perhaps you added it by accident (with some shortcut).
Also, while reinstalling IntelliJ, you have probably imported your previous settings. With it, you inherited this issue.
If this doesn't help, please share a screenshot of your project/module structure and setup.
Last but not least, try to create the file using the context menu. E.g. try to right click on your src folder and select new and select Java class or Package from the options. Would be good to check anyway, to see if these are valid options. If they do not appear here, it indicates the project setup is erroneous.
Solved! Thanks to #yole I did the following 'make sure that the *.java extension is listed in "Registered patterns" for the Java file type in Settings | Editor | File Types".
I have the JD-eclipse-plugin installed. I want to decompile the classes within a jar-file. So I select the jar-file within Project-Explorer and click Decompiler in the Menu. However both decompilers (JAD and JD-core) are greyed out.
I also tried the steps shown in this blog on AVAJAVA Web Tutorials. I guess the blog is a bit outdated, however I can see within Windows-->Preferences-->Java-->Decompiler that Jad is correctly set up. But there is no JD-eclipse found within Preferences-->General-->Editors-->File Associations as you can see in the following image.. Now I right click the jar-file within Project-Explorer, but there is no such "Attach Source File".
Did I miss anything to set up the plugin?
EDIT: I´m using the following setup: Eclipse: Mars.1 Release (4.5.1); JadClipse 4.0.0; JDK 1.8
EDIT2: Forgot to mention that I use Tomcat and want to dive into the libraries from /WebContent/WEB-INF/lib. This is not working, I cannot further collapse the jar-files.
For Eclipse 2018-09 , the problem was related to " class without source
"
I had resolved this issue by going to:
Preferences
General
Editors
File Associations
Class without source
and setting decompliler viewer as default : see the following screen shot:
Obviously I mixed the actual JD-eclipse-plugin an a plugin called JadClipse for Eclipse which is a slightly different plugin from eclipse marketplace. Thus when I followed the installation instructions of JD-eclipse, I could set the options for the screenshot posted within the question. So I set JD-eclipse as default for both *.class-files with and those without source-code.
Second mistake I did was a pretty silly and obvious one, namely that I wanted to browse the jar-files from within WEB-INF-folder of my Tomcat instead of from within Java Resources. Thus I could not dive into the jar-files at all hindering me to get to the class-level and thus to decompile those classes contained within the jar.
I hope this helps anyone outside also having trouble with the plugin for eclipse.
I had the same problem but "class without source" did have decompliler viewer as default. So all I did was set class file viewer as default and then switched back and that fixed the issue.
I had to update all of my plugins. the Procyon decompiler has this symptom when running under java 11 or later.
OK, I have a really basic (read stupid) question. I am just beginning Java programming, and am using Eclipse 3.7.2. I have done a few beginning projects without any problems. All of a sudden, when I create a new project using the wizard, it is not creating the src/.java file. When I try to manually add it after creating the project, I end up getting some cryptic error messages.
I have re-followed several walk-throughs on project creation for clues as to any option I may have accidentally un-checked and no luck.
Googling the answer brings up results for more advanced problems that are unrelated.
I have combed the preferences, but nothing looks obvious, and
I have gone hunting for any user app data I could delete to force a clean slate.
I have even created a new instance of Eclipse to a different directory and still have the same result.
My son's instance, which is on the same computer still creates the .java file from the wizard. The only difference is that my instances have the Android SDK installed (I am trying to create basic Java projects and not Android projects).
I am at a loss, and have lost a lot of time trying to correct the situation. What do I need to do to reenable the creation of a src/.java file in Eclipse?
Screenshots (click on image for full size):
Make sure you are choosing a java project from the right folder in the wizard. It sounds like it is creating an android java project, which is probably why your src folder is missing. See if there is a helloworld project under example projects too in the wizard, that may get you started too. Screenshot may help us. I want to see which project type you choose and which folder it is in.
How about changing eclipse to point to a new workspace. That may drop the android settings. Under the file menu, choose switch workspace and pick a new location. Thats most likely why a new install did not fix it. That workspace may have android settings in it, so change to a new folder somewhere else to test it like c:\workspace2\
Here's a good tutorial I found that may help too.
eclipse java project tutorial
I have a problem with Eclipse Indigo regarding library source code. When I open a library class (e.g. from the JDK, but also from some other included libraries, such as Guava), either using the Open Type dialogue or simply through Ctrl+ click on the class name or some of its methods, once in a while (not always) something breaks.
Don't get me wrong, the source is always displayed without any problem (either JDK source shipped with the JDK itself or Guava source downloaded by Maven). What actually stops to work:
When I open the Quick Outline popup in that given class using Ctrl + O, the list of methods and fields displays normally, but when I click on any of them, Eclipse doesn't move the view on it as it should. Also Ctrl + clicking any of the methods or fields of that class in my code doesn't bring me directly to it, but simply at the top of the source file.
When I hover over that said class or its methods, no JavaDoc appears in the popup as you can see in the attached image. I am in the HashSet class, the source is clearly there, but it isn't displayed in the popup.
I found out that this can be fixed by opening the Outline View and briefly clicking through the class's methods and fields. After a few clicks, Eclipse catches on and starts to work correctly, but only for this one class, not for all which are broken in this way at the moment.
Has anybody met this kind of bug? Is it tracked at Eclipse Bugzilla? Thanks in advance for any advice.
For completeness, this is my configuration:
Windows 7 Professional x64
Oracle JDK 1.7 Update 2 32b
Eclipse Indigo for Java EE Developers 32b
your issue #2 may be resolved by following these steps :
Go to http://java.sun.com/j2se/1.5.0/download.jsp and choose to
download the JDK 5.0 Source Code.
For JDK 5.0, select Download(SCSL source).
Download JDK (SCSL) 5.0 (1.5.0). This will give you a file jdk-1_5_0-src.scsl.zip. You do not need to unzip this file; Eclipse likes it the way it is.
In Eclipse, go to Projects -> Properties -> Java Build Path -> Libraries and expand JRE System Library [jre 1.5.0], then rt.jar. Select Source attachment and click Edit...
Select the above zip file. and Finish by exiting the dialog boxes.
source
Hope this helps..
Sounds like wrong sources are attached to the libs inside Eclipse.
I had similar symptoms in a project where a class exist in both: inside a lib and in the project's src folder. Same canonical class name, but different implementations.
I would recommend to verify (or reinstall) your JDK-Installation and re-configurating it in Eclipse.
Hitting Ctrl+Shift+T and typing HashSet and taking a screenshot of that window may help here, too.
To answer my own question, I didn't find out how to solve the problem in Indigo, but updating to Juno fixed it.
How can I add JavaDoc or other document to netbeans ?
I try with this way :
Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip (in my desktop)
but in editor when I press Ctrl+Space in tooltiptext this message shown :
Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager.
I tried restarting NetBeans but this was the result:
try this in NetBeans IDE
Choose Tools > Java Platform Manager from the main window.
Select the platform to which you want to add Javadoc in the left panel of the dialog box.
In the Javadoc tab, click Add ZIP/Folder and specify the location of the Javadoc files.
Click Close.
Hope this helps.
If you are using maven in your project then follow below steps to attach Java docs for your attached libraries.
Right click on "Dependencies" folder of your project.
Then choose "Download javadoc" option
It will download javadoc of your libraries and attached it.
Now when you will press ctl + space then you will see docs for that library.
and If you want to add javadoc for particular library then follow the options as suggested by Himanshu Soni.
You can't usually just add the javadoc zip as a separate library (at least this hasn't worked for me in the past.) In the libraries section you need to select the library you want to add the Javadoc for and then add the Javadoc jar for that specific library.
Restart Netbeans then that should work. Though of course if there really is no Javadoc for that method you still won't get any (I've fallen into that trap a couple of times before!)
You followed the very right procedure, I've been threw this right before I write this answer, and as for this is the first result that shows up when you Google the problem, I think that many people will find it handy and save their time, the solutions is:
UNZIP the JavaDoc.zip file that you are referring to ( which is supposed to be jdk-7u4-apidocs.zip for JavaSE 7 docs) and repeat the same procedure, which is Tools --> Java Platforms --> Javadoc ( tab ) then press " Add Zip/Folder, and point to the unzipped folder instead of the zipped one, restart NetBeans, and it will work smooth and direct.
You should download the docs file from the following link:
http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html
After completing the described operation, you will have your javadocs available offline, and you don't need to be connected to the internet to know about APIs.
Best regards brother.
"Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip"
The problem with above step can be solved easily by moving down following two path already added in content panel as shown below.
Step 1-
Goto: Tools >> Java Platform >> JavaDoc Tab
and Add ZIP/Folder you want to add.
Step 2-
Step 3-
That's all and if zip file doesn't works the extract first and then add it.
I had the same problem, and I solved it by removing all URLs and adding only the apidocs.zip downloaded from oracle. After that restart your NetBeans.
Before test whether it works be sure the method you are looking for actually exists within the apidocs. Open index.html and make a search for that particular package.class.method you need.
If it doesn't work, try to manually copy the apidoc.zip to the docs directory of netBeans:
C:\Program Files\NetBeans 7.1.2\java\docs and then retry.
this help me:
http://wiki.netbeans.org/FaqJavaDoc#Adding_the_JDK_Javadoc_to_the_NetBeans_IDE
try it, maybe help
Using a Maven project inside of Netbeans v8.02.
First, view your project via the Projects window;
Expand your project's Dependencies folder
Right-click the desired *.jar file
Click download javadoc
Done!
This worked for me, I manually copy the apidoc.zip to the docs directory of netBeans: C:\Program Files\NetBeans 7.1.2\java\docs and then restart my netbeans.