Problem in eclipse configuring tomcat - eclipse

I have trouble when I want to configure eclipse. This error appears, but I dont know where is my problem. I copied apache-tomcat-7.0.5 folder in E:\Java folder, where is java installed.
Tomcat requires a Java SDK in order to compile JSP files. Ensure that the JRE preference settings point to an SDK install location.

Related

Automatically linking Java 8 source code with Eclipse IDE

In my installation of Eclipse IDE (Mars 4.5) it has not automatically linked rt.jar and jfxrt.jar to src.zip and javafx-src.zip. I know how to do this manually by browsing to the .zip files within the JDK installation.
What I want to know is if there is a way to ensure this happens automatically when installing Eclipse / Java. I'm pretty certain I know someone who didn't link to the source manually and it is linked on their installation.
For example, if you install the JDK before Eclipse, or vice-versa, does this make any difference?
Also, when you make the link, where abouts is the preference information stored on the file system - is it somewhere within the same folder that eclipse.exe exists?
To make sure that Eclipse is running in your JDK instead of a JRE (The JDK installation typically puts a JRE on the system executable path), you should always specify it via eclipse.ini. The -vm option described there tells Eclipse exactly what JVM you want it to run in.
Another option is to add the JDK to the Installed JREs section of your Eclipse preferences and set that as the default for all projects. The default JVM used for projects is the same as the one Eclipse itself runs in, so you don't necessarily need to do both.
Once you have the JDK set as the default JVM, you can open a project's Properties, select Java Build Path section, then look at the Libraries tab. You should see your JDK as the JRE System Library, including its rt.jar and corresponding source attachment. Like this:

Bundle Jre downloaded as maven dependency with Install4J

I am using maven to build my install4J project. I am downloading jre.tar.gz into my project using a Maven dependency. I want to bundle this Jre with Install4J.
I have created a compiler variable bundleJRE which is the path to the jre.tar.gz file, and I created the installer executable.
While installing on a non-java machine, I get an invalid JRE error. Do I need anything else to be configured? How can I bundle this?
We have the same way to build our installer with maven. If the jre is packed correctly ensure the search sequence for the JRE is set to the installation folder first (or only). You can configure that in the "General Settings -> Java Version" configuration tab. We only added the installation folder and deleted all the other entries. Also ensure the minimum java version matches with your bundled one.

Java executable jar file is not running properly

I have built an executable jar file using netbeans IDE, it works fine in my system but yesterday I gave it to my friend and he is complaining that the file is not running, it just show the splash screen and then closes, he has JRE 6 installed.
I am unable to resolve the issue. Can someone help?
The problem is, you build the jar using JDK7 and you want to run it on JDK6. It will become error. Try to downgrade and build jar again using JDK6.
Right-Click on your project properties and select Libraries and change the Java Platform.
If the JDK6 didn't come out, please make sure to add it from Tools > Java Platforms and Add Platform...

How is the Eclipse JDK setting affecting the system's JDK setting

I was trying to compile a Grails application referencing third party JARs on Mac OSX. Although my system's JRE and JDK is set to Java 1.6 I always got a Compilation error: java.lang.UnsupportedClassVersionError: Bad version number in .class file
when accessing classes in the JAR. Also when testing an existing Grails app the default stats of the app where showing that it's running with Java 1.6. So I really didn't have more ideas than to try to change the Java settings in Eclipse - I thought that's stupid as I'm not using Eclipse for the devlopment of this application - but voila - now the compilation of my app on the command line works just fine!
Can anyone explain me what Eclipse is doing here behind the scenes?
I've had set the JAVA_HOME manually before with no effect.
The JDK (JAVA_HOME) used to launched eclipse is not necessarily the one used to compiled your project.
To see what JRE YOU y can select for your project, check the preferences
General > Java Installed JRE
By default, if you have not added any JRE, the only one declared will be the one used to launched eclipse (which can be defined in your eclipse.ini).
You can add any other JRE you want, including one compatible with your project.
After that, you will need to check in your project properties (or in the general preferences) what JRE is used, with what compliance level:

Debugging a tomcat project in Eclipse 3.4.2

I downloaded eclipse 3.4.2 and tried installing tomcat plugin (version 3.2.1)for eclipse from sysdeo (http://www.eclipsetotale.com/tomcatPlugin.html)
I have followed installation instructions but when is start tomcat from eclipse toolbar i got the following error
java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/SystemLogHandler
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:205)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390)
I did follow troubleshoot instructions but no success.
I tried to putting plugin in dropin directory too but still got the same error.
This was working fine in eclipse 3.2 and 3.3
Then I tried using standard inbuilt WTP to set up my tomcat server. I am not sure how it will pick my server.xml in conf directory of tomcat, it seems it is not picking as of now.
How do I associate my eclipse project with this setup. I am able to start the server but when i browse the tomcat start page, it does not show anything.
I would appreciate if someone can provide some ways to fix this.
Thanks in advance.
-Dipesh
After trying out few things I was able to debug tomcat project in eclipse 3.4.2
To debug tomcat application/project using eclipse 3.4.2 use WTP plugins which are installed along with it.
Go to Window --> Show View --> Others --> Server
In this view create a new server, please select tomcat installation directory and version information.
Then double click on Tomcat VX.X Server at local host, it opens up configuration settings page
In the Server Locations Section select "Use Tomcat Installation (takes control of Tomcat Installation) and enter deploy path.
In the publishing section select Never Publish automatically and uncheck update context path checkbox.
Voila!! All set to debug tomcat project in eclipse 3.4.2
There is no need to download and copy any extra plugin.
Thanks Juri. Hope this helps.
I'm using Tomcat with Eclipse Java EE version with WTP and it works perfectly. I have Ant scripts which deploy my web app to the tomcat webapp folder. In order to debug, you have to open the Server view in Eclipse, add a new server and choose the correct Tomcat version. Once that's done, open the configuration of Tomcat within eclipse by double-clicking on the server entry in the Eclipse server view you just created. On the left-middle side of the confguration page you should see something like "let Eclipse control the native Tomcat installation", I don't remember the exact text now. You have to choose that. Then you can set a breakpoint in your source code and then start Tomcat in debug mode from within Eclipse's server view.
Hope that helped.
If you are using the Sysdeo plugin, then you don't want to also be using the standard Eclipse WTP servers. To use the Sysdeo plugin, you need to have already downloaded and extracted a standard zipped tomcat directory. Make sure to define CATALINA_HOME in your path. Then, assuming you've correctly installed the sysdeo plugin, go into Eclipse->Windows->Prefs->Tomcat (this is Sysdeo's Tomcat settings, and not the WTP settings). You need to tell the plugin where you've extracted your Tomcat directory, and set it to use Context files.
Now create a new Dynamic web project. Right click it, and go into its properties->Tomcat.
Check it as a 'Tomcat Project'. Give it a context name, and also tell it the directory which would be the base of your war (by default, Eclipse has named this WebContent, I believe). Apply it and close the Window. Right click again your project, and go to the Tomcat section. Add the 'Tomcat Libraries to Build Path' so you can use the Servlet/JSP classes. Finally, click on 'Update Context'. If you go into your Tomcat directory under Conf, you'll see that the plugin has created a context for you that points to your Eclipse workspace. No need for deploying the app to the Tomcat directory. Now, you should be able to click on the Sysdeo Tomcat 'start' button, and your app should be able to connect to your app at localhost:8080/context_name.
HTH,
Bill
Using the excellent Findjar web page for:
org/apache/tomcat/util/log/SystemLogHandler
gives the following:
Information on class org.apache.tomcat.util.log.SystemLogHandler:
Containing JAR files:
jbossweb.jar
gwt-dev-windows.jar
tomcat-util-3.3.2.jar
tomcat-util-4.0.6.jar
tomcat-util-4.1.31.jar
tomcat-util-4.1.34.jar
tomcat-util-4.1.36.jar
tomcat-util-5.0.16.jar
tomcat-util-5.0.18.jar
tomcat-util-5.0.28.jar
tomcat-util-5.5.12.jar
tomcat-util-5.5.15.jar
tomcat-util-5.5.23.jar
tomcat-util-5.5.4.jar
tomcat-util-5.5.7.jar
tomcat-util-5.5.9.jar
tomcat-util-5.5.7-alpha.jar
tomcat-util-5.5.8-alpha.jar
tomcat-util-5.5.9-alpha.jar
Ensure the appropriate jar file is in your CLASSPATH.