errors while trying to build the application

i have application in struts for which i have created a build file, when i am trying to run build.xml i am getting this error messsage.

 Launching(Error: Specified VM install not found: type standard VM, name jre1.6.0_01)


 help me fix this problem and any further problems relating to this after.
gkmadhavAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bpmurrayCommented:
Are you running ant from inside Eclipse? If so, try this:

  * Right-click on the build.xml file and select Run as -> Ant build ... (note the three dots!)
  * This displays a dialog -select the "JRE" tab.
  * Click on "Run in the same JRE as the workspace"

Alternatively, try playing with the JRE settings to get one that works for you - this depends on which JRE's you have installed on your machine.
0
gkmadhavAuthor Commented:
i was able to run it following your procedure but now i got this compile error after running it


[javac] bad class file: C:\Program Files\Java\jre1.6.0_01\lib\rt.jar(java/lang/Object.class)
       [javac] class file has wrong version 49.0, should be 48.0
0
bpmurrayCommented:
OK, sounds like you're mixing JREs. Eclipse has probably one and ant is being executed using another. Check your environment variables - do you have JAVA_HOME pointing to the correct JRE? Do you have your JRE directory on the PATH? What's your CLASSPATH set to? These should all match what's in Eclipse, or you should change the properties of your project to use the other JRE (Preferences->Java).
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

gkmadhavAuthor Commented:
I am not able quite understand what you are saying but to some extent and here is my classpath set to in the environment variable and there is no JAVA_HOME set in there



CLASSPATH     .;C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava

QTJava     C:\Program Files\Java\jre1.6.0_01\lib\ext


if you want i will even let you know what preferences i have set in eclipse, i mean installed JRES and also properties of the application like the java build path
0
cmalakarCommented:
>> class file has wrong version 49.0, should be 48.0

This error will come, when there is mismatch in the libraries being read by eclipse, and the version of compiler being used..

The compiler versions should be consistent(should be same) in all the following places...

1) Window > Preferences > JAVA >  BuildPath > Classpath Variable > 
   a) value of JAVA_HOME variable should point to correct compiler..
   b) value of JRE_LIB variable should point to correct rt.jar (which will be inside jre\lib)
2) Window > Preferences > JAVA > Compiler
   a) Value of Compiler Compliance level should be correct.
3) Right-click on the build.xml file > Run as > (Ant build ...) > JRE
   a) Run time jre should point to correct JRE.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cmalakarCommented:
I think.. by updating

"JRE_LIB" to whatever "JAVA_HOME" is pointing..

your problem should be solved.
0
bpmurrayCommented:
Set your CLASSPATH variable to nothing.
0
gkmadhavAuthor Commented:
Thank you cmalakar and bpmurray,

now  i am getting this error, i have included ejb.jar and weblogic-ejb.jar in META_INF of the build file but still i am getting this error. if its needed i will post even my build file.

BUILD FAILED: C:\Kalyan\Java_Eclipse\Struts\TaskManager\build\build.xml:74: weblogic.utils.compiler.ToolFailureException: [J2EE:160119]Appc is unable to process the file 'C:\Kalyan\Java_Eclipse\Struts\TaskManager\build\TaskManager.jar'. The following error occurred:
weblogic.utils.compiler.ToolFailureException: [J2EE:160113]Error: The source file, 'C:\Kalyan\Java_Eclipse\Struts\TaskManager\build\TaskManager.jar', is not a valid ejb-jar file. To be valid, it must contain a META-INF/ejb-jar.xml file.
      at weblogic.appc.compileInput(appc.java:424)
      at weblogic.appc.runBody(appc.java:186)
      at weblogic.utils.compiler.Tool.run(Tool.java:192)
      at weblogic.utils.compiler.Tool.run(Tool.java:147)
      at weblogic.appc.main(appc.java:1037)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at weblogic.ant.taskdefs.j2ee.CompilerTask.invokeMain(CompilerTask.java:278)
      at weblogic.ant.taskdefs.j2ee.Appc.privateExecute(Appc.java:199)
      at weblogic.ant.taskdefs.j2ee.Appc.execute(Appc.java:124)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:385)
      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:136)
 - with nested exception:
[weblogic.utils.compiler.ToolFailureException: [J2EE:160113]Error: The source file, 'C:\Kalyan\Java_Eclipse\Struts\TaskManager\build\TaskManager.jar', is not a valid ejb-jar file. To be valid, it must contain a META-INF/ejb-jar.xml file.]
0
gkmadhavAuthor Commented:
heres my build file

<?xml version="1.0" encoding="UTF-8"?>
<project name="TaskManager" default="deploy" basedir=".">
<property name="src" value="../src"/>
<property name="tld" value="../tld"/>
<property name="build" value="build"/>
<property name="jsp" value="../JSP"/>
<property name="web" value="${build}/web"/>
<property name="ejb" value="${build}/ejb"/>
<property name="app" value="${build}/app"/>
<property name="deployDir" value="C:\MyProject"/>
<target name="all" depends="clean,init,copy, web,ejb,app"/>
 <target name="clean">
        <delete dir="${build}" />
 </target>
 <target name="init">
      <taskdef name="wlappc"
            classname="weblogic.ant.taskdefs.j2ee.Appc"
            classpath="C:\bea\weblogic81\server\lib\weblogic.jar"/>
  <mkdir dir="${web}"/>
  <mkdir dir="${web}/WEB-INF"/>
  <mkdir dir="${web}/WEB-INF/classes"/>
  <mkdir dir="${web}/WEB-INF/src"/>
  <mkdir dir="${web}/WEB-INF/lib"/>
  <mkdir dir="${ejb}/META-INF"/>
  <mkdir dir="${app}/META-INF"/>
</target>
<target name="copy">
      <copy todir="${web}">
            <fileset dir="${jsp}">
                  <include name="**/*.jsp"/>
            </fileset>
      </copy>
    <copy todir="${web}/WEB-INF">
           <fileset dir="../XML">
                 <include name="*.xml"/>
                 <exclude name = "application.xml"/>
           </fileset>
    </copy>
      <copy todir="${web}/WEB-INF/lib">
                  <fileset dir="../LIB">
                              <include name="*.jar"/>
                  </fileset>
      </copy>      
      <copy todir="${web}/WEB-INF/src">
                  <fileset dir="${src}">
                              <include name="*.*"/>
                  </fileset>
      </copy>      
      <copy todir="${app}/META-INF">
            <fileset dir="../XML">
                  <include name="application.xml"/>
            </fileset>
      </copy>
      <copy todir="${ejb}/META-INF">
            <fileset dir="../XML">
                  <include name="ejb-jar.xml"/>
                  <include name="weblogic-ejb-jar.xml"/>
                  <include name="weblogic-cmp-rdbms-jar.xml"/>
            </fileset>
      </copy>
</target>
<target name="web" >
      <javac srcdir="${src}"  destdir="${web}/WEB-INF/classes" includes="**/action/**/*.java, **/connection/**/*.java, **/form/**/*.java, **/helper/**/*.java " excludes="**/ejb/**/*.java"/>
      <jar basedir="${web}" jarfile="${app}/TaskManager.war"/>
      <delete dir="${web}"/>      
</target>
<target name="ejb">
            <javac srcdir="${src}" destdir="${ejb}" includes="**/ejb/**/*.java" />
          <jar jarfile="TaskManager.jar" basedir="${ejb}" update="yes"/>
    <wlappc source="TaskManager.jar"
                  output="${app}/TaskManager.jar"
            forceGeneration="true"
            verbose="true"
            deprecation="true">
        <classpath>
            <pathelement location= "C:\bea\weblogic81\server\lib\weblogic.jar"/>
        </classpath>
    </wlappc>
      
      <delete dir="${ejb}"/>
</target>
<target name="app" >
      <jar basedir="${app}" jarfile="TaskManager.ear"/>
      <delete dir="${build}"/>
</target>
 <target name="deploy" depends="all">
            <delete dir="${deployDir}\MyApp"/>
            <mkdir dir="${deployDir}\MyApp"/>
            <mkdir dir="${deployDir}\MyApp\TaskManager"/>
            <unjar src="TaskManager.ear"
                    dest="${deployDir}\MyApp">
            </unjar>
            <unwar src="${deployDir}\MyApp\TaskManager.war"
                    dest="${deployDir}\MyApp\TaskManager">
            </unwar>
             <delete file="${deployDir}\MyApp\TaskManager.war"/>
  </target>
</project>

0
bpmurrayCommented:
Well, you have all the correct copy and setup stuff all laid out correctly. The only issue is what is in the generated file. Dump the jar file:
     jar tvf TaskManager.jar

to see if the xml file has been included. Interestingly, the copy looks right:
      <copy todir="${ejb}/META-INF">
            <fileset dir="../XML">
                  <include name="ejb-jar.xml"/>
                  <include name="weblogic-ejb-jar.xml"/>
                  <include name="weblogic-cmp-rdbms-jar.xml"/>
            </fileset>
      </copy>
 so that should be OK, but the Appc call seems not to see it after the jar
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.