How to show Java Dependency (to add external jar) in vscode? - java

I am working on Quarkus application in vscode and we want to add external jars to that application, I have seen few demos but in my project "Java Dependencies" tab is not there, how to show it?
Please Help me out as I am new to it.
This "Java Dependencies" tab is not visible in my above project.

Click your project under JAVA PROJECTS, click + to add Maven Dependencies:
Detailed information please view Project Management in vscode-java: Add a dependency

I know this is really late; I stumbled here when trying to solve this problem myself. Now that I have found the solution, I am sharing on this for anyone coming this way later so, here goes: You can simply click on the '+' button to add external JARs (see in the screenshot).

Related

Run a Maven Project using IntelliJ IDEA

I'm new to IntelliJ IDEA and I would like to run a simple Maven Quickstart project using it.
I followed all the instructions, the project was sucessfully built. But when I try to compile and run it , the Run button is not activated.
It looks like IntelliJ IDEA couldn't figure out where the main class is.
This is a picture of the project's hierarchy.
What is the problem ? And how can I fix it ?
Thanks !
Refresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.
The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java file appears in a plain directory instead of the Source root.
You can tell that by the color of the folders and by the icon of the file.
You need to create a Java Project.
File->New->Project->Java->Next->Next->Finish
Then go to the top and do:
Right click parent folder of project->Add Framework Support->Click Maven->Ok
Now Maven should be added to your project and also you should be able to run it
If this doesn't allow you to run the project, click the little drop down box to the left of the grayed out run button and click Edit Configurations.
Then click the + and click Application and set your Main class to the class that has the main method in it, and then it should allow you to run the application.
Hope that helps!
Seems like your java directory is not marked as Source root. Right click on it and click Mark directory as -> Source root
Have you imported the project as a maven projet ?
If yes, click on the body of your fonction and then do CTRL+MAJ+F10 or MAJ+F10
My issue was that I was looking for the equivalent of calling "mvnw" from the console/terminal.
.mnvw (linux) OR mvnw (windows)
I didn't know where this was in IntelliJ. That's how I interpret part of the question that was asked.
The solution wasn't obvious to me so I wanted to share it.
Conceptually, you want to run the default maven configuration (not a specific lifecycle stage). Therefore you need to select the root entry in the Maven panel:
Then you can play the green play button on the panel:
Alternatively, you can right click and run the maven build from the context menu.
If maven not visible top-right side then maven plugins not avaiable in your intellij IDE.
Follow below steps:
click settings icon(top-right side)->select plugin->click on checkbox at maven option->click apply button then ok button.
After few minutes maven able to see in you IDE.
You need to add to project e.g. Jetty or Tomcat (compile to WAR & run Tomcat server with this war).
If you will have Jetty maven plugin you will be able to run app via mvn jetty:run (Add this to Maven run configuration)

NetBeans and Maven: Build dependencies upon running a project

I was wondering whether or not it is possible to tell NetBeans (I am running NetBeans 8.0.2) to build a project (let's call that "Project A") that is a dependency of another project (let's call that "Project B") whenever the second project is run.
I'll try to explain:
Project A is a library. Project B is a simple test application for said library. Ergo, once I change anything in the library (A), I need to build it before I can run/debug the test application (B). Oh, both projects are usign Maven (but I'd prefer a solution that does not involve Maven).
From time to time it simply happens: I forget that I have to build the library and wonder why my changes won't work (well, of course they won't, the library's changes have not yet been built).
So my question is: how can I tell NetBeans (I'd prefer not to use Maven for this) to always build the library when I run or debug the test application?
Hope you guys can find me an answer to this question, it's driving me crazy!
Thanks in advance, feel free to ask if I did not make everything clear.
How to add one Maven project as a dependency of another in Netbeans:
Open Both Projects
Right-click Dependencies under Project B
Choose "Add Dependency ..." from pop-up menu.
Select the Open Projects Tab in the Dialog box.
Select Project A from the list.
I made a screencast video showing Netbeans working correctly with a dependant module: https://youtu.be/SOp070b3m24
In the video, mavenproject9 depends on mavenproject10. I edit a value in a class in mavenproject10 and then immediately run mavenproject9 and get the updated value.

Build path problems with sdk

I just downloaded the Android SDK and the plugin but when I try to create a project it automatically makes a library for the support and my project that I created has errors. Here is what I mean:
This is after I clean up the projects [Project -> Clean]
Additionally, R does not work (even when I import it) :
This is all with a clean project. I would appreciate it if you could help me.
Note: I know there are similar questions out there, but I could not get it working.
I think I need to import the appcompat package again, but I do not know where to locate it.
The error the container "Android Dependencies references non existing library" probably means your build path isn't pointing to any jar file. I recommend checking your build path:
Right click and choose 'build path'
Click on 'Android'. Make sure app_compact appears under the library target. If it does not click 'add' under library to add it.

ZeroMQ with android: NoClassDefFoundError: org.zeromq.ZMQ

I have a problem with getting ZeroMQ to work on android. I compiled everything into the .jar and .so file that i needed. Then I added zmq.jar to /libs/ and the libjzmq.so to /libs/armeabi/ and added the .jar to the build path. (right-click -> build path -> Configure build path ... -> Libraries -> Add JARs...)
I've also marked the .jar for export in the "Order and Export" tab and moved it to the top of the list, but i still get "java.lang.NoClassDefFoundError: org.zeromq.ZMQ".
What else can I try?
I'm using Eclipse by the way.
Thanks in advance.
This is not a proper answer to your direct question as I was unable to solve the same problem. Recently I came across JeroMQ on the mailing list and am now using it in an internal application for instant messaging. It is working very well but requires ZeroMQ 3.x. ZeroMQ is very easy to install so that should not be a blocking issue.
Take a look at the GitHub repo here:
https://github.com/miniway/jeromq
If you are using Git, you can add that as a submodule or you can simply pull the code and add it into your main app. I would highly recommend the former, but I ended up doing the latter simply to get my test app up and running easier.
I got the problem too! The way it works for me is to set the package order in Preferences->Java Build Path->Orders and Export. Select the checkbox of zmq.jar, and click the 'up' button to make it in the first line in the list, then the error disappears happily, hope this would be helpful to you :)

Android Eclipse Classpath - want to add classpath container path but eclipse won't let me

I'm using Eclipse to learn to develop Android applications in Java. I haven't used Eclipse before.
The project I'm trying to use (supplied by OReilly as part of 'Android Application Development') is MJAndroid. When attempting to run the project, the Run fails, and the Problems tab mentions com.java.Object can't be found, and Eclipse asks me to check the build path. Clicking
Properties -> Java Build Path -> Libraries, the message 'Unable to get system library for the project' is displayed.
On a working project, Properties -> Java Build Path -> Libraries has an entry for Android 1.1, which if I click Edit, has the classpath container path of com.android.ide.eclipse.adt.ANDROID_FRAMEWORK.
It seems a simple matter of adding the correct container path to my non-working project. However Eclipse seems determined to make this as difficult as possible. No matter what I chose to add - jars, externals jars, variables, libraries, class folders, external class folders, nothing seems to take the form of 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK' that the 'Android 1.1' entry on the working app has.
How can I add this namespace to my project so it resembles the working one?
I'm quite sure it's a problem with Eclipse's somewhat odd user interface. Frankly there' nothing I'd prefer more than a file to modify and set such information - my background is in Python, and the whole eclipse environment seems an unnecessary burden.
I had faced the same issue when I imported a sample code downloaded from the internet. I am using android sdk 1.5 with 0.9 ADT plugins. Here is a simpler way to fix the andoid library reference issues
Right click on the project which has
issues and select properties
Select the appropriate Android build
(1.1, 1.5 or 1.5 with google api) and
say ok
Again right click on the project and
select "Android Tools > Fix Project
Properties"
Fix the imports once (if required)
Refresh the project and you should be
ready to go without any manual
editing
I faced this same problem after importing a project through GIT. The problem was that I didn't have the same target android platform installed, and the build path somehow got corrupted.
The first obvious thing i did was changing the target sdk in the project.properties, but even after cleaning up the project and Android Tools > Fix Project Properties, it didn't help and I was still getting the build error.
My solution after wasting close to 1 hour trying to figure this out?
RESTART ECLIPSE
Everything worked fine after that. Eclipse is pretty fickle. Only through years of experience you'll then understand her well. :)
Had the same problem and it turns out the Android SDK Location was not set which was a really simple fix. Go to Window->Preferences, click on 'Android' on the left hand menu, fill in the location of the Android SDK (e.g. C:\Program Files\Android\android-sdk) and click OK. Everything worked fine for me after that.
Found the answer in this set up guide: http://developer.motorola.com/docstools/library/Installing-Android-Dev-Environment/
Sometimes Eclipse can get a bit funny (technical term) with classpath container resolution.
You have a working project in your workspace, so you can rule out plugin installation issues. You could try opening the .classpath file (hidden by default, select the triangle in the top-right of the Package Explorer view, select Filters... and uncheck .* resources) and manually adding the container declaration.
`<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>`
You may then have to close the project and open it again (right-click->Close Project) before Eclipse recognises the change.
You may also find that there is an Android builder and/or nature. If you compare the .project files for the working and non-working versions you may see entries for Android builders/natures. Copying the relevant entries may resolve the issue.
sometimes, eclipse can help you.
In Android projects, click right button on the project-> Android Tools -> Fix Project Properties.
It's usefull in class path errors!!
Luck!
I would verify you have the correct version of Java installed as well as the Android SDK. I would recommend installing/reinstalling the ADT plugin in your eclipse, makes it alot easier to create the android project.
http://developer.android.com/sdk/1.5_r2/installing.html
Also. I guess the path of the Android SDK must be setup correctly. This happened when I was overloaded with projects and I decided to create a new workspace copying some existing stuff into it.
Seems that the new workspace requires you to setup these details too once again
Is that setup properly?

Categories

Resources