I have written some Java code that I need to export into an EAR file. I am using Eclipse 3.6.2 I have looked at
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jst.j2ee.doc.user/topics/tjexpear.html
but the problem is that I do not have the export destination "J2EE"--> EAR file in Eclipse.
Also when I go to New--> File --> Other there is not such an option. I did add the JAR-file "ejb-api-3.0.jar" to my project though and Eclipse does not give me any errors.
What am I doing wrong?
You have to use Eclipse Java EE for making War Files. You can also add the required plugins into your existing Eclipse but downloading the Java EE version would be much easier.
Related
I am using Eclipse 2020.03 and Java JDK 13.
I downloaded the appropriate JARs from the JavaFx download site.
When I run my project in Eclipse, there are no errors.
However, when I export the JAR and run it, the program encounters a runtime error that reads
No toolkit found
Here is what my JAR looks like when I change the extension to a .zip and open it:
Clearly, all of the required JavaFX library JARs are in there.
I have also tried using the export mode where Eclipse extracts the library JAR source code into the exported JAR but the same error occurs.
What am I doing wrong?
Edit: I am not open to using Maven.
I am working with Ewon hardware project which supports javaetk run time environment.
Now some of the functionality like JsonReader, Logger, etc are not available in javaetk. So I download this jar file externally and include it in my project.
Looks fine at Eclipse level! But at run time it shows error on Ewon error blog that class not found! Any suggestions, that how can I use this??
We could extract external jar files of higher versions of java environment and put it in our project's bin folder. So works fine!
Well, I has a doubt about compiling a java project into eclipse.
Note: My project is not using maven.
If i want to get a .ear or .war file what is the way?
I want to compile my project and get all compilation errors, because I change my jdk version, from jdk 1.5 to jdk 1.8
And this is why I want to compile it getting my compilaion errors, to fix them and get the ear or war files
I mean, may I compile from project -> clean -> built automatically
And this gonna give me this kind of files?
Or i have to compile it from command prompt?
Hope you can help me, any idea is a good one.
Thanks a lot.
you can use Export option to create WAR or EAR file provided the project is created as Dynamic Web Project or Enterprise Application Project.
switch to java 8:
1. add JRE 8 libraries into your project classpath
2. change the compiler version to 1.8
Then select the Project->Build Automatically. you can see the errors in Error Log View or Markers View
I am trying to go through the Java EE 6 Tutorial samples with Eclipse.
It seems it will be very hard.
I just started.
I found the Hello and Hello1 samples cannot be used in Eclipse directly.
Other than these NetBeans specific files/folders,
the java files are under "src/java/" folder but the "java" folder is NOT a package name. Eclipse doesn't like this structure.
Is there an easy way to convert these samples to be usable with Eclipse?
Are there any other Java EE sample sets can be used in Eclipse?
Install Maven plugin for eclipse (ME2Eclipse) or use an Eclipse version, which already contains the plugin like Eclipse for Java EE Developers.
Then import the hello1 example as existing maven project.
In Eclipse you can build and deploy the project with Run maven install.
If you don't use maven, you have to set the source folder in Java Build path as mentioned from DwB in the post before.
A detailed description for your first project you will have in the Firstcup example installed with the glassfish server.
Eclipse does not care which folder is used for the java source;
however, you will have to tell eclipse which folder to use by choosing the source folders in the project properties!Java Build Path!Source tab
(open project properties, select the Java Build path option on the left side, select the Source tab).
I'm developing an Installer for a project team to reduce the amount of work they have to do installing it manually.
We are using:
Windows 7 x64,
Eclipse Kepler
Right now I'm looking for a way to import a .war file using the commandline.
Is there any way to do this via cmd?
First of all, I would not recommend importing the source code from a file in Eclipse if you have a team of developers, as you would be giving everyone a version that will hardly be actual after some days of work. Using some repository (CVS, SVN, GIT) would be the way to go.
If you have your code in a central repository, then you could make a "Project Set" file in Eclipse wich can be imported easily to setup your whole workspace:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-cvs-project-set.htm
This project set might have instructions on how to construct the Workspace based on checkouts of the repositories you need.
If you happen to work at a company that uses some X or Y old-fashioned Source Control tool (or worse, none at all), and you have no chances of implementing one that is compatible with Eclipse (like the three I stated above), then the time you are saving with automating the import of a war file will become irrelevant compared to the source code control issues you will be facing (or the team is facing already).
A WAR file is a ZIP file. If you need the content of the WAR you can use the tools for ZIP archives.
A workaround in case eclipse does not have any such options would be to
do a Import WAR through eclipse GUI
check what changes are made to workspace by eclipse (eg. folder created with exploded war file content, configuration files created by eclipse in the folder like .classpath for project folders etc)
Identify the steps and replicate the same through a batch file
Add a call to the batch file in eclipse launch short cut
There is no command line API I know to do this task for Eclipse just from command line, but with the right tools you can achieve what you want.
Please try this:
Straightforward approach that works with any GUI application. You can use AutoIt scripts for interaction with any application. The downside is that GUI may change more frequently than command line API.
Try to create Eclipse project with metadata and unpack WAR file in this project. It can be done, for instance, with Maven or Gradle. Those also can download all dependencies for you.