i'm trying to compile a Java Web Service client with the windows console but there are 100 errors. The client has been made in eclipse, and in it's console it works good. Here it is the code:
public static void main (String[] args)throws Exception{
try{
MireiaUPMPortTypeProxy proxy = new MireiaUPMPortTypeProxy();
proxy.setEndpoint("http://138.4.47.33:8087/axis2/services/MireiaUPM.MireiaUPMHttpSoap11Endpoint/");
String respuesta=proxy.getNER("[content]David is in the office.[/content]", "en");
System.out.println(respuesta);
}catch(Exception e3){
e3.printStackTrace();
}
}
}
When i compile the kind of errors that appear are: Cannot find symbol and org.apache axis.constants does not exist
Could you help me? i'm new at using web services and i'm so lost. The extrange thing for me is that it runs well in the eclipse console, but it doesn't compile.
it runs in Eclipse simply because dependent libs (jars!) are set in eclipse build path.
to be able to compile from OS console/terminal, you have to set classpath correctly. check eclipse build path (right click on project and look for this menu) and add those dependencies in your console command.
Please make sure your all related jar files are on class path when compiling your class files.
Related
I made a java application using javaFx on Eclipse IDE.
I am using JavaSE-11 compiler and the javafx-sdk-11 version.
It works when I run it from Eclipse, but now i'm trying to make a runnable .jar of the application.
When I double click on the .jar, nothing happens. I tried installing, uninstalling and reinstalling Java ...
Here are the issues I'm having when I try to launch it with [java -jar filename.jar] command :
Extracting the required libraries into generated JAR
java : Error : JavaFX runtime components are missing,
and are required to run this application
Packaging the required libraries into generated JAR
java : Graphics Device intialization failed for : d3d, sw
Error initializing QuantumRenderer : no suitable pipeline found
Don't hesitate to ask me more details, I'm not very good at this but I'm trying my best.
Thanks
I had same problem few days back. I just made another class that doesn't extend Application, and has its own main. Then just launched the application from that class like so:
public class Fakemain {
public static void main(String[] args) {
game.main(args); //this is the class that extends Application
}
}
Let me know if this worked for you.
I am facing a problem while i am trying to compile a code at eclipse in java. The code is the following:
public class New {
public static void main(String[] args){
System.out.println("hello world");
}
}
Parts that have errors are New, String and System. I have checked at error list and the description for error's is like:
Unable to create editor ID
The file does not exist
Any idea why this is happening?
Your project has or classes maybe has beeing dissapeared.
I can give you a possible solution
Solution: Shut down Eclipse IDE Start Eclipse IDE (with -clean to be super-safe) Reimport all projects (UPDATE: Just use File->Import->Existing Project into Workspace and browse your workspace/project directory)
I have an open source project (WAR file) imported to my Eclipse.
I have all java code sources in WEB-INF/src/... folder.
I have User java file with following code:
public class User {
public User () {}
public void create (){}
public void test(){}
}
Which create method has been made by the open source project creator, while test is new method that I create.
Then I tried to call from my login.jsp:
User user = new User ();
user.create();
user.test();
The user.test(); returns error The method test() is undefined for the type User, while the rest works fine.
I tried to check the build class and it only has the create method. Tried to clean and build the project, still doesn't resolve my problem. What is the cause of this error? Eclipse seems doesn't build my project.
This is quite strange since I did this before and didn't work, but now it works.
I resolve this problem by moving all the java codes from WebContent/WEB-INF/src/<my-package> to Java Resources/src/<my-package>
I am trying to use JackRabbit lbrary for SVN chekin operation.
What I run my code through individual program this works fine. But when I run using web based project it doesn't work.
Code compiles fine but gives me runtime exception at following line :
MkActivityMethod activityMethod = new MkActivityMethod(url);
The exception is :
java.lang.NoClassDefFoundError: org/apache/jackrabbit/webdav/client/methods/MkActivityMethod
My project has jackrabbit-standalone-2.6.4.jar included in my eclipse jars as well as in project web-Inf/lib folder
Please let me know where I am going wrong.
There is obviously something wrong with your classpath. What Web Server Are You Using?
Here is my solution :
Try to build the project once again
Check the JDK version for the builder and Server JRE
Try clean the project (In eclipse , Project menu -> Clean )
Reason :
After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader, which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use. It probably indicates that you haven't set the classpath option when executing your code. This link explains how to set the classpath when you execute.
I have a Scala project and I would like to export it as a jar.
*1. At first I tried creating a Java class for the project as an entry point
public class JMain {
public static void main(String[] args) {
System.out.println("Java main calling Scala main");
SMain.main(new String[] {""}); //SMain.main is the actual *main*
and this worked fine and dandy when launched from Eclipse, but when I export it as jar it'll give me 18 exceptions or so. I do now know how to replicate then "environment" in which Eclipse manages to launch this and I'm prety sure it relies on the fact that Scala is on my system already - I need a self contained jar with everything packed in there.
*2. My second try consisted of trying what lach suggested here How to deploy a Scala project from Eclipse?
namely:
public class JMain {
public static void main(String[] args) {
System.out.println("Java Main");
List<String> argList = new ArrayList<String>();
argList.add("fully.qualified.ClassName"); //???
for (String s : args) argList.add(s);
scala.tools.nsc.MainGenericRunner.main(argList.toArray(new String[0]));
This time it won't even run from Eclipse, although it gives only 6 or so exceptions starting with the famous NoClassDefFoundError. I have a feeling I'm not getting fully.qualified.ClassName right. *3. If the main Scala class is called "Dis.scala" and is located in package "pack" shouldn't this fully.qualified.ClassName be "pack.Dis"?
I'm using Jre 1.6 and Scala 2.9.2
EDIT: I have included all external imported jars, even scala-library.jar - everything is nice and packed in the jar
P.S. I am not familiar with Ant or Maven or Sbt. I just want my Scala project jared - if possible without getting into hairy things.
Here is what worked for me:
1. Create scala project
2. Create Wrapper java project
3. Add the scala-library.jar to you java project build path.
So you only need the 3rd step in addition since the rest looks similar to what I did. Then you can happily use: java - jar file.jar
EDIT:
How to create a JAR File which contains Scala/Code which can be consumed by another Java Project, using Scala - Eclipse IDE.
Create a new Scala Project and define an object with a main method as entry point.
Now create a new Java Project and add your Scala Project to the new ones buildpath. Additionally add the scala-library.jar to the Java project.
Now create a Wrapper class in the java project which calls your entry point class from the scala lib. Run the wrapper class to create a eclipse run configuration and test if you can call the scala project.
Use the Export->Java->Runnable JAR file, Wizard now on the wrapper project.The eclipse run configuration will be used as entrypoint into the JAR. Depending on your needs you may want to :
extract required libraries into generated JAR
or
Package required libraries into generated JAR
Finally you get a complete packaged JAR which you can use like this:
java - jar wrapped.jar
For me, it was relatively straightforward.
Develop and test the project using the scala IDE (or eclipse for java).
once ready, generate the jar for the project using file -> export method.
for submitting the spark (i was writing something for spark), i just had to mention --class option for specifying the main class for the jar.
hope to help.