I am very new to java
I downloaded an open source java project
which has this line of code
import sun.swing.SwingUtilities2;
I am getting this error
Error:(94, 38) java: cannot find symbol
symbol: variable SwingUtilities2
location: class org.apache.ctakes.gui.component.SmoothToolTip.SmoothToolTipUI
I have downloaded this jar file from here
http://www.java2s.com/Code/Jar/j/Downloadjsdgstubsjre15jar.htm
I am trying to add it to my project
through going to project structure in IntelliJ and then add library
but I get another error when i click the ok button
how to import this library in my project ?
It's like to be a maven project.
if so, why not trying to add the dependency instead of downloading the jar file manually?
try to add:
<!-- https://mvnrepository.com/artifact/com.sun/tools -->
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
</dependency>
to your pom file and then build the project again.
this way maven download it for you automatically.
Related
Maybe a newbie question...
I've been working on a LWJGL project, where I use Maven to manage dependencies. In it, I want to use some parts of the libgdx library. So I figured I will first run at least a helloworld working with it before I add it to my main project.
So in my pom.xml I have this:
<!-- https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-backend-lwjgl -->
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-lwjgl</artifactId>
<version>1.9.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-platform -->
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-platform</artifactId>
<version>1.9.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx -->
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx</artifactId>
<version>1.9.11</version>
</dependency>
The other contents of the file are the same as in a working project and are 100% working.
I tried creating a separate libgdx project before that and... it didn't work. But, I saw that the code that was supposed to run the program was:
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new SomeApplicationListenerFile(), config);
}
So I used that in my maven project.
When I do "run as a Java Application", the error is the following:
Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/backends/lwjgl/LwjglApplicationConfiguration
at org.boby.RayTracing.main.Main.main(Main.java:179)
And if I do a Maven Build, it tells me that "package com.badlogic.gdx.backends.lwjgl does not exist"
I looked for that package in the jars Maven downloaded in the "Maven dependencies" folder and I found it in gdx-backend-lwjgl-1.9.11.jar - right where it should be.
The package is apparently there, but Java cannot find it. How can I fix that?
Some additional information:
Windows 10, eclipse oxygen, Maven 3.6.0, JRE 1.8.0_191, JDK 8
Thank you in advance! I've been banging my head on this for hours.
Edit: I made some progress. Looks like the "test" was messing things up so I removed those statements. Now I get the following Error:
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx64.dll' for target: Windows 10, 64-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:125)
at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:33)
at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:47)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:83)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:71)
at org.boby.RayTracing.main.Main.main(Main.java:178)
It looks like I need to include gdx-natives.jar in my dependencies, but I can't find a maven repository for it.
I downloaded gdx-natives.jar (saw it in a forum thread). In there, was a file named "gdx-64.dll". As I need "gdx64.dll", I just renamed the dll and now it runs.
You can let Maven do the work if you define the gdx-platform dep like this:
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-platform</artifactId>
<version>1.9.11</version>
<classifier>natives-desktop</classifier>
</dependency>
This will load the natives jar including the gdx64.dll so you don't have to add any external jar to your project in the build path.
A side note is: if you use the standard Maven repo directory structure and you load assets with the Gdx.files.internal("fileName") statement you need to define a folder in the main/repository with the same name as the package you have your code in. (i.e. main/java/myPackage relates to /main/repository/myPackage). I struggled a bit with this because I don't normaly have to define a package folder int the repository dir.
I am still trying to get the example in this tutorial to work:
http://www.automationtestinghub.com/first-appium-test-script/
I am getting a ClassNotFoundException in the line:
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(caps);
I have added java-client-6.0.0-BETA2.jar to my Build Path.
What am I missing?
This is not in any way connected to the question: How to resolve 'the import io cannot be resolved' - that part has been resolved.
Update 03/01/2018
I have converted my project to a Maven project.
Then I added the following to the pom.xml:
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.0.0-BETA2</version>
</dependency>
Then I ran Maven Build with Verify Clean.
The result was still the same:
ClassNotFoundException
Update 04/01/2018
Finally got this working.
I got a response from Appium support - “Selenium requires guava library to be in classpath.”
First I added the android version - but that gave a different error.
When I added the regular version - it all worked:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.6-jre</version>
<!-- or, for Android: -->
<version>23.6-android</version>
</dependency>
My advice would be to add maven framework support to your project.
If using IntelliJ do the following:
Right Click your folder structure and hit Add Framework Support
Then tick the Maven box and click OK to add this as a Maven Project.
You should then have a pom.xml generated within your folder structure open this.
Within this pom.xml you need to add the following code:
https://gist.github.com/michaelvoase/54f3bbf47b888bb004330a1d1b108068
This will then import the Appium library into your project.
We created client for web-service with security policy to call the other web-service by passing the required information like username,password and other information..Jdeveloper had given the support for security policy and their packages but to create the war and building the application we are using maven.
when we compile through maven it is giving the compilation errors.
Can any one suggest is there any plug in to add in the maven to compile the code..
Please click below link to see the image of compilation error :
Compilation errors in console when we run Maven
The Package weblogic.wsee.jws.jaxws.owsm is part of weblogic middleware and is installed on the modules folder.
You can add it to your maven repository for example Nexus as:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ws.api</artifactId>
<version>1.1.0.0</version>
</dependency>
The file is %MW_HOME%\modules\ws.api_1.1.0.0.jar
or, of course, if you don't want the hassle of going through adding artifacts to the repository:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ws.api</artifactId>
<version>1.1.0.0</version>
<scope>system</scope>
<systemPath>${mw.home}/modules/ws.api_1.1.0.0.jar</systemPath>
</dependency>
I'm writing assignment on coursera.org Java course. I'm using Maven and I have external jars that I have to use in this course (course requirements).
This is part of my pom.xml:
<dependency>
<groupId>org.coursera.algs4part1</groupId>
<artifactId>stdlib</artifactId>
<version>1.0</version>
</dependency>
I can't make java compiler import the external jar file. Below, following errors occur:
The import org.coursera.algs4part1.stdlib cannot be resolved
But I've successfully added the jar to maven:
What am I missing?
You need to do the following steps if you have a eclipse-maven plugin installed.
Run the command mvn eclipse:eclipse
Go to Project Properties > Build Path > Libraries tab > Add Variable... button > Configure Variables... button > New button. Enter the variable name as M2_REPO and its value/path to the Maven Repository path (Usually it's like C:\Users\<username>\.m2\repository.)
1.create a folder src\lib and paste your jar file
2.your pom.xml should be like this.
<groupId>org.coursera.algs4part1</groupId>
<artifactId>stdlib</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\lib\stdlib.jar</systemPath>
</dependency>
Hopefully this will solve your problem and for more details visit http://noexceptionfound.blogspot.in/
I see the jbox2d Vec2 class in the repository:
http://code.google.com/p/playn/source/browse/gwtbox2d/src/org/jbox2d/common/Vec2.java
How do I make the PlayN port of JBox2D package accessible to my code? I'm using Eclipse but my project does not appear to be aware of the package.
Update:
Following the example here, I've added playn-jbox2d as a dependency in my core/pom.xml file. However, when I load my project I get the following error:
ArtifactDescriptorException: Failed to read artifact descriptor for
com.googlecode.playn:playn-jbox2d:jar:1.1.1:
ArtifactResolutionException: Could not transfer artifact
com.googlecode.playn:playn-jbox2d:pom:1.1.1 from/to central
(http://repo1.maven.org/maven2): Failed to transfer
http://repo1.maven.org/maven2/com/googlecode/playn/playn-jbox2d/1.1.1/playn-jbox2d-1.1.1.pom.
Error code 416, Requested Range Not
Satisfiable pom.xml /myproject-core line 1 Maven Dependency Problem
After a bit of a goose chase, I figured out how to enable this. Following the example here, I manually added playn-jbox2d as a dependency in my core/pom.xml file. Here is what that section of my pom.xml file now looks like:
<dependencies>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-core</artifactId>
<version>${playn.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-jbox2d</artifactId>
<version>${playn.version}</version>
</dependency>
</dependencies>
Then in Eclipse:
Right-click core directory in Package Explorer window > Maven > Update Dependencies
Thanks to all who offered assistance.
You need to add JBox2D library to your workspace. Follow Basic guide for importing and building JBox2D. There are instructions for eclipse as well. Or you can download JBox2D jars and add them to eclipse. Here is a tutorial how to add jars to your workspace.