Link to home
Start Free TrialLog in
Avatar of gordontm
gordontm

asked on

Cannot find Main Class in Eclipse

1.      I am using Eclipse 3.4.2, Oracle Thin Client OC4J Standalone Server 10.1.3.n
2.      I right-click my project (a Dynamic Web Application with .jsp and java classes)
3.      I select Run As/Run On Server
4.      I choose an existing server localhost/Oracle OC4J Standalone Server 10.1.3.n at local host
5.      I click Next
6.      I see that the project is in Configured projects
7.      I click Finish

I get the message from Java Virtual Machine Launcher. "Could not find the main class. Program will exit."

I have googled and looked on Experts-Exchange but to no avail.

When I go to Properties, Java Build Path I see the error Project X cannot reference itself  It seems probable that this is part of the problem&
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Are you able to start the server from the Eclipse "Servers" window without any deployed web application? This sounds like you haven't a correctly configured server descriptor as far as Eclipse is concerned.

Is this an OC4J specific project, or is it standard Java web app that you can try to deploy in Tomcat?
ASKER CERTIFIED SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gordontm
gordontm

ASKER

Hi mrjoltcola

Thank you very much for replying and for your very detailed instructions!

I am following your instructions dilligently and am in step 3.

However there are all sorts of .jars that are missing from the classpath.  I have copied and pasted about twenty so far, but now I am stuck.  

Eclipse asks for  Missing classpath entry C:\oracle\oc4j10.1.3.4\j2ee\home\..\..\lib\xmlparserv2.jar
and unfortunately it doesn't specify what the directories are between home and lib, but just writes \...\...

I have tried to google "default directory xmlparserv2.jar" but I do not seem to be able to know where to put xmlparserv2.jar

Do you have any ideas?


Were you able to create an OC4J server in step 2, using the 10.1.3.n ? You browsed to the correct directory?

You should not need to copy any jars to setup the server with Eclipse Ganymede, I did it with no add-ins.

What JDK/JRE have you installed?

Perhaps also moving this to the Java zone would help.
1. Hi. See the first picture.  When I press [Next] I get the second picture
2. Please note I still have the problem "Project 'X' cannot reference itself".  Maybe this is part of the problem
3. JDK is either j2sdk1.4.2_12 or j2sdk1.4.2_13 or j2sdk1.4.2_05.  [I am a little confused about this last point]

Thanks very much!



step1.jpg
step2.jpg
I recommend installing a 1.5 JDK (since OC4J claims it can support 1.4.2 or 5.0)
I am using Java 5 and 6, haven't used 1.4 in yrs.

Try configuring the new JDK as your standard Eclipse JDK, then try it all over.
I have downloaded jdk-1_5_0_18-windows-amd64.exe
[I will be unable to use this in the long term because the live application using 1.4] but I will try here locally on my laptop to see if I can get it working.

I right-clicked the JRE System Library [j2sdk1.4.2_12] and tried to change it to alternate JRE / JRE1.6.05 but it complains that "Application of the classpath container changes failed. Project "X' can not reference itself."



JRE 1.6 is Java 6, not 5, so you have 3 versions in your environment you area dealing with.

Sorry, I have no other suggestions. I only use Java 5 & 6, and really don't use OC4J much anymore either. I recommend posting to Java zone as well, you can add the zone to your question.
Thank you very much for trying mrjoltcola.  Thank you for your suggestion about java zone. I will try and move it.
Hi mrjoltcola.  I managed to follow all your instructions.
Basically the problem was that somehow my project referenced itself in the Web App Folders. Once I got rid of this, then everything was a breeze.

I will now give you the points as you answered my question!.  However the application is still not working... When I go to Servers, the application is started  (see picture below) but when I go to http://localhost:8888/charm/  it doesn't work.  I will open another question, could you have a look at it?

https://www.experts-exchange.com/index.jsp?qid=24408753
Make sure to post in Java, Eclipse and Web app servers if possible. Post a link back to this one in case anyone needs some background. Not being an OC4J guru, I probably cannot help much more except to just try it myself. I will look in on the question and contribute if possible.

OK. Thanks for advice.
I put it in Java, Eclipse and Oracle [before reading your comment]
If no-one answers I will ask an administrator to move it to Web App. [its not possible to move once zones have been assigned]
Use request attention for an admin's help