i have a problem when run Spring MVC on Eclipse
but when i clear the extra path it works properly
whats the main problem here?
In the first image, I can see that you used HomeController.java in url. You cannot make url in that way. Homepage path need to define in the web.xml file. By default web.xml contain path as project name so your project is working fine with project name in the url path which is absolutely correct.
However, remember that java never execute .java file. Java execute .class file which is created through compilation of .java file. I hope this will help to understand java better.
Related
I created an example microprofile app. And the readme says i can start it with java -jar myjar.jar
But when I try it i get an error that no manifest.mf exists.
I really don't have one in my example generated project. But when I extract the jar, there is one generated, but without a main class.
How is a Microprofile app even supposed to run? I know there is a class extending Application. But how should I handle this manifest file?
Ok sorry just realized IntelliJ placed the projet into another folder. So now I have two folders. And handled the wrong project.
I am trying to create a WebServices REST project with IntelliJ IDEA. The idea is to supply some files to the user, but it seems that I can't find them in Tomcat's directory. For now I am trying to serve just a simple index.html page, but Java reports that the file could not be found. My current project structure is this: I thought that any data should be in the WEB-INF folder, or have I put it in the wrong place? Also, this is my GET function with the class I'm using: Any idea what I am missing?
I am working on a Java project (Eclipse IDE) which is using XWT files for UI purposes (which is basically an xml file). I need to dynamically edit one of those file during execution of the programm.
However, the project will not be executed from a definite directory and I need to get a relative path to the file.
So, say that my file is located under:
com.foo.goo.src.com.foo.goo.toto
Which translate on my disk by:
C:\\com.foo.goo\src\com\foo\goo\toto\file.xwt
But eclipse working directory is "C:\Eclipse\Workspace"
Is there a way to open this file ?
Thanks
Just use Paths class and the get method, like so:
Paths.get("C:\\file.txt").toFile()
Problem solved using FileResolve(URL url) :)
I am doing a project in which one part is openid authentication. I am using Java.
I downloaded the code from the below site:
http://www.ibm.com/developerworks/java/library/j-openid/index.html, it said that he used wicket.
I tried to execute with tomcat server. I am able to compile the java files successfully.
But when I tried to run the openidregistration.html and put www.myopenid.com or (http)://pratap533.myopenid.com, it is not at all responding.
I am in big trouble as I have to complete the project to get my degree.
I included the openid4java.jar, joda-time.jar and wicket.jar file and the C:\Downloads\FileServe Manager\openid4java-sample-app\src all these files in classpath.
So I compiled them and was successful.
I created the wicket folder in webapps and in which I put web-inf. In web-inf I created classes folder and also copied the web.xml in web-inf folder.
In the classes I put all the 4 classes of wicket folder.
When I tried to run the openidregistration.html and put www.myopenid.com or (http)://pratap533.myopenid.com
it was not at all responding..
in web.xml file it is with servlet tags. those tags i did not include them.
Please any body help me..
I think I need to use eclipse, but I am not getting what is the problem.
I tried the following steps with the sample code you have mentioned and its working fine for me except i was getting connection failure error which might be due to the proxy network.
here are the steps for you
Create a dynamic web-application in eclipse IDE.
copy the jars from sample to the jar lib folder in your new project (created in step1).
replace the web.xml from the one from sample application.
copy the SRC folder from the sample application to the one created by you.
If you want to see what is happening inside the application copy the log4j.properties file from sample application to the src folder.
Follow the above 4 steps and you will get a running application what they have in there tutorial.
hope this will work for you.
I have added a piece of sharepoint code to the existing java file which was compiling and working fine. The sharepoint code that is written uses some of the external libraries. Now I need to add the external library to the existing project through ANT.
I have done a few modifications in the build.xml file and hence resolved all the compilation errors. However when the code is getting executed, I get an Error message saying "java.lang.NoClassDefFoundError: net/entropysoft/eci/spi/IContentProviderFactory". Please help me resolving this error.
Also please let me know what needs to be added in the build.xml file to resolve the error.
All the jar files is present in the directory "externallibs"
Thanks,
Rajath
You need to have all the jars in the classpath when running the application:
java -cp externallibs/* com.foo.bar.Main
If it's a Java EE web application, the build process should copy all these jars to the WEB-INF/lib folder of the generated web app structure.
java.lang.NoClassDefFoundError: net/entropysoft/eci/spi/IContentProviderFactory does not mean the class net.entropysoft.eci.spi.IContentProviderFactory is not found. It means the class that is used within this class are not found anywhere in the classpath. This error is thrown when the class loader is trying to load the class but it cannot properly initialize the class definition.
To solve this problem, you will need to look at the source code of the class net.entropysoft.eci.spi.IContentProviderFactory, usually at the import section, and determine what is the missing Java class and which library the missing class is in. Once you know you can add that library to your classpath using the answer by JB Nizet. If you run it from IDE, then you will need to add that library to you build.xml.