Solved

Cannot find Main Class in Eclipse

Posted on 2009-05-13
13
3,406 Views
Last Modified: 2013-12-18
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&
0
Comment
Question by:gordontm
  • 7
  • 6
13 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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?
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 250 total points
Comment Utility
Try this in Eclipse

1) Download the latest standalone OC4J, unzip to C:\OC4J

http://www.oracle.com/technology/software/products/ias/htdocs/utilsoft.html

2) In Eclipse: Window -> Preferences -> Server -> Runtime Environments -> Add
Choose Oracle -> Oracle OC4J Standalone 10.1.3.n -> Next
Choose Default JRE
For the OC4J J2EE home, use browse to C:\OC4J\j2ee\home

3) In Server's tab, right clock, New -> Server, choose Oracle OC4J Standalone 10.1.3.n, add the project,

Before starting from Eclipse, start from command line:

set OC4J_HOME=C:\oc4j\j2ee\home
set ORACLE_HOME=C:\oc4j
set JAVA_HOME=... path to your JDK...

cd \oc4j\bin
oc4j -start

Enter your new admin password ("admin")
Then CTRL-C to shutdown

Then go to Eclipse and start the OC4J from the Server's tab, if that works, then move on to attempt to deploy a web app to it. This works for me except I have not deployed an app to the container.


Other references that might help:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial
0
 
LVL 2

Author Comment

by:gordontm
Comment Utility
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?


0
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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.
0
 
LVL 2

Author Comment

by:gordontm
Comment Utility
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
0
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Author Comment

by:gordontm
Comment Utility
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."



0
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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.
0
 
LVL 2

Author Comment

by:gordontm
Comment Utility
Thank you very much for trying mrjoltcola.  Thank you for your suggestion about java zone. I will try and move it.
0
 
LVL 2

Author Closing Comment

by:gordontm
Comment Utility
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?

http://www.experts-exchange.com/index.jsp?qid=24408753
0
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
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.

0
 
LVL 2

Author Comment

by:gordontm
Comment Utility
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]
0
 
LVL 40

Expert Comment

by:mrjoltcola
Comment Utility
Use request attention for an admin's help
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now