error while creating jar file - applet

problem is occurs while creating jar file "java exception occurred" that's why i have added zip file is it sounds correct or not what i have to do can you please tell me?

to create jar file in java eclipse
1)write a java coding in eclipse 2)run in java platform 3)click to file->export->runnable jar file->next->launch configuration(project name)->export destination(destination folder)->finish 4)open the destination folder 5).jar extension file is nothing but your jar file

Related

Eclipse's Ant needs jsch

I run ant script file in my Eclipse IDE. File contains command scp:
<scp file="myfile.txt" todir="user:password#somehost:/home/chuck"/>
This line causes error:
Cause: Could not load a dependent class com/jcraft/jsch/Logger
It is not enough to have Ant's optional JARs
Why my Eclipse's Ant does not have this class and where I can download requied library? How to know which library version is needed?
You can have a look here for JSCH http://www.jcraft.com/jsch/
There is a Download section where you can find a .jar (jsch-0.1.54.jar at time of writing).
Then you have to setup ANT buildpath to use this jar.

Maven build path error

I'm created a maven project using eclipse and it gives me following build path error
Description Resource Path Location Type Archive for required library: 'C:/Users/scjayasekara/.m2/repository/org/springframework/spring-beans/4.1.1.RELEASE/spring-beans-4.1.1.RELEASE.jar' in project 'KromeSoop' cannot be read or is not a valid ZIP file BookStore Build path Build Path Problem
I remove the complete repository and update all projects in the workspace. But it didn't work either. any suggestions to solve this issue??
I got the answer.
I just replace spring web-mvc 4.1.1 dependency with spring web-mvc 4.1.3 and it solved the build path problem.

Trouble running jar file created by Eclipse

I exported my Eclipse project as a runnable Jar file, added a manifest, as well as the appropriate class files with the command:
jar cfm JarFile.jar manifest.txt *.class
However, when I try to run the jar file with
java -jar JarFile.jar
I get the error that it "Could not find or load main class" etc. etc.
The structure of my manifest.txt file looks like this:
Main-Class: EclipseProjectName.src.packagename.mainclassname
(With a carriage return at the end)
Is something wrong with my manifest file? If not, what may be the reason that the main class cannot be found?
Thank you!
The manifest file extension should be .mf i.e manifest.mf. See here for jar file specification
Suggest to use fat jar eclipse plugin for exporting java projects as runnable jars.
Edit
Correct the content of manifest.txt as shown below
Main-Class: EclipseProjectName.src.packagename.mainclassname
project name and src are not required. Refer this
The entry in the META-INF/MANIFEST.MF entry in the finished jar file should be
Main-Class: packagename.mainclassname
and should correspond exactly to
/packagename/mainclassname.class
in your jar file (or jar file_s_ if you use Class-Path too).

Error in Eclipse about type indirectly referenced from required .class file

I'm having this exception with some stubs generateds by Axis2:
"The type org.apache.axiom.om.OMElement cannot be resolved. It is
indirectly referenced from required .class files"
I've been reading many posts, and trying to find a solution. What I've found so far is to add the apache tomcat 5.5 library to the build path. It removed the error in the java file, but then, when I to execute any java program inside the project, I got this error:
'Launching myApp' has encountered a problem Exception occurred
executing command line. Cannot run program "C:\Program
Files\Java\jdk1.5.0_22\bin\javaw.exe" (in directory
"D:\Digicel\workspace\Digicel\myClassSample"): CreateProcess error=87,
The parameter is incorrect
then if I remove the apache tomcat library from the build path, I can run the other java programs, but not the one mentioned initially.
Any thoughts about it?
Okay, I've found the cause of the problem with the help of a friend :)
The thing is that Eclipse is aware that one of my dependencies, depends of another library, and Eclipse is checking for it when it tries to build the code.
So, what I've done is try to check which jar file contains this library: " org.apache.axiom.om.OMElement".
I've googled it and found that it is "axiom-api-1.2.10.jar" and finally my file compiled with 0 errors.
He also explained to me that my original solution of adding the apache tomcat server library is adding all the jars that cames with apache tomcat (which is a big list), and probably there may have been a version conflict with my current list of added jars.
So, the fix was to find the appropriate jar and add it to the project.
This error can also occur when a indirect dependency has a corrupt jar file. This may be caused by problems at the public maven repository.
If this is the case removing the local maven repository to download fresh jar files will fix your problem:
rm -Rf ~/.m2/repository/{enter/path/to/broken/stuff}
Goto Maven >Update Maven project>checkmark the Force update >Then Run
..That error Will gone....

Only a type can be imported. org.apache.poi.hssf.usermodel.HSSFWorkbook resolves to a package

Trying to use Apache POI in a Eclipse JSP project. The POI jar is in the project's Java Resources Library list.
<%# page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
at run the following error occurs:
An error occurred at line: 7 in the
generated java file Only a type can be
imported.
org.apache.poi.hssf.usermodel.HSSFWorkbook
resolves to a package
Any ideas? Thanks
Don Lawton
The message indicates that the class could not be found on the classpath of your deployed application. Did you make sure that the POI jar is in your WEB-INF/lib folder?
Same happened to me, even when the needed jars were indeed in the WEB-INF folder.
I was using the provided server in SpringSource ToolSuite (STS). It took me several attempts to clean, republish, etc... before it finally worked.