Tutorial Step 8 - Compile and run Client

I have been unsuccessful in getting the client to run from the command prompt.
I have modified the compile and run bat files as follows"
COMPILE.BAT
c:\bea\jdk131_03\bin\javac -classpath ../../WEB-INF/lib/Investigate.jar;../../WEB-INF/lib/webserviceclient.jar;c:\bea\weblogic700\server\lib\webserviceclient.jar
*.java
RUN.BAT
c:\bea\jdk131_03\bin\java -cp .;../../WEB-INF/lib/Investigate.jar;c:\bea\weblogic700\server\lib\webserviceclient.jar;
InvestigClient
What am I missing????
===============
C:\bea\weblogic700\samples\workshop\applications\samples\tutorials\java_client>c
:\bea\jdk131_03\bin\java -cp .;../../WEB-INF/lib/Investigate.jar;c:\bea\weblogic
700\server\lib\webserviceclient.jar; InvestigClient
Exception in thread "main" java.lang.NoClassDefFoundError: InvestigClient (wrong
name: tutorials/java_client/InvestigClient)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:10
6)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)

Craig,
The error suggests the absence of the class file 'InvestigClient.class' in
the CLASSPATH.
Could you please confirm that you were able to compile the client correctly.
Please check that you have the Investig.class file in the
tutorials\java_client directory.
I was able to run the client successfully here.
Regards,
Anurag
Workshop Support
"Craig Hall" <[email protected]> wrote in message
news:[email protected]...
>
I have been unsuccessful in getting the client to run from the commandprompt.
I have modified the compile and run bat files as follows"
COMPILE.BAT
c:\bea\jdk131_03\bin\javac -classpath../../WEB-INF/lib/Investigate.jar;../../WEB-INF/lib/webserviceclient.jar;c:\
bea\weblogic700\server\lib\webserviceclient.jar
*.java
RUN.BAT
c:\bea\jdk131_03\bin\java -cp.;../../WEB-INF/lib/Investigate.jar;c:\bea\weblogic700\server\lib\webservice
client.jar;
InvestigClient
What am I missing????
===============
C:\bea\weblogic700\samples\workshop\applications\samples\tutorials\java_clie
nt>c
:\bea\jdk131_03\bin\java -cp.;../../WEB-INF/lib/Investigate.jar;c:\bea\weblogic
700\server\lib\webserviceclient.jar; InvestigClient
Exception in thread "main" java.lang.NoClassDefFoundError: InvestigClient(wrong
name: tutorials/java_client/InvestigClient)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
atjava.security.SecureClassLoader.defineClass(SecureClassLoader.java:10
6)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)

Similar Messages

  • Java compilation and running within jsp page

    hi,
    i need of a jsp page that has a textarea in which the java coding are entered and this coding is compiled and executed. The execution result is printed.
    Please guide me.

    I don't think you can invoke java compiler or run time environment at client side (browser). Even if you use applet, i think you will not be able to do it at client side. Moreover, though java virtual machine will be available in your target user's browser, but you should not expect a java compiler in users machine.
    I have seen exam sites where they have added java code compilation and execution ability. To achieve this you can do:
    1. In your JSP page use text area where user can edit java code.
    2. Provide two buttons - 'Compile' and 'Run'.
    3. On click of 'Compile' send the code to server side. In server machine create a file in a temporary location in disk and save the code content received from client.
    4. Invoke 'javac' command (as a separate process) to compile the java class created in step 3. This process will give you error/output back which you can send back to user.
    5. In case of 'Run' you must first invoke above mentioned 'Compile' service and then another service ('Run') to actually run you java class. You can build 'Run' service in similar way.
    Here you challenge would be managing multiple client requests (to compile and run java class) at the same time.
    Code to compile and run java classes:
    import java.io.*;
    * A class to compile and run java classes.
    * @author Mrityunjoy Saha
    public class JavaProcessor{
         public static void main(String[] args){
              // Option 1 to compile and option 2 to run.
              int option=1;
              if(args.length > 0){
                   option=Integer.parseInt(args[0]);
              JavaProcessor p=new JavaProcessor();
              if(option==1){
                   p.compile();
              } else {
                   p.run();
         public void run(){
              String file="FoodTest";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("java", directory, file);
         public void compile(){
              String file="FoodTest.java";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("javac", directory, file);
         public void executeCommand(String command, String directory, String file){
              try{
                   String[] envp=null;
                   // Make sure that you have done Java setup in your machine.
                   // To test this try invoking javac command in command prompt.
                   Process p=Runtime.getRuntime().exec(command+" "+file,envp,new File(directory));
                   BufferedReader errorStream=new BufferedReader(new InputStreamReader(p.getErrorStream()));
                   String readData="";
                   while((readData=errorStream.readLine())!=null){
                        System.out.println(readData);
                   BufferedReader outStream=new BufferedReader(new InputStreamReader(p.getInputStream()));
                   readData="";
                   while((readData=outStream.readLine())!=null){
                        System.out.println(readData);
              catch(IOException ioe){
                   ioe.printStackTrace();
    }Thanks,
    Mrityunjoy

  • Error in compiling and running a packaged application

    Hi all,
    I am new to java and studying alone java from sun's site.Now i am going through sun's step by step programming.From there i got a packaged Application named DiveLog which i wrote and saved in divelog directory in jdk1.2.2which is in C directory.
    When i tried to compile it i got the error message as class Resource .java not found.But i have created the file Resource.java and saved in the same divelog directory.
    somehow i get rid of the error and looked for the directory but class file is not there.So i understood that Compilation doesn't took place.
    Can anyone help me to get rid of the error and compile and run the Application successfully.
    Here is the DiveLog application i have written.
    package divelog;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DiveLog
    private JTabbedPane tabbedPane;
    private JFrame dlframe;
    public DiveLog()
    dlframe = new JFrame("A Java(TM) Technology Dive Log");
    dlframe.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0)
    tabbedPane = new JTabbedPane(SwingConstants.LEFT);
    tabbedPane.setBackground(Color.blue);
    tabbedPane.setForeground(Color.white);
    populateTabbedPane();
    buildMenu();
    dlframe.getContentPane().add(tabbedPane);
    dlframe.pack();
    dlframe.setSize(765,690);
    dlframe.setBackground(Color.white);
    dlframe.setVisible(true);
    private void populateTabbedPane()
    tabbedPane.addTab("Welcome",
    null,
    new Welcome(),
    "Welcome to the Dive Log");
    tabbedPane.addTab("Diver Data",
    null,
    new Diver(),
    "Click here to enter diver data");
    tabbedPane.addTab("Log Dives",
    null,
    new Dives(),
    "Click here to enter dives");
    tabbedPane.addTab("Statistics",
    null,
    new Statistics(),
    "Click here to calculate dive statistics");
    tabbedPane.addTab("Favorite Web Site",
    null,
    new WebSite(),
    "Click here to see a web site");
    tabbedPane.addTab("Resources",
    null,
    new Resources(),
    "Click here to see a list" + "of resources");
    private void buildMenu()
    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem item = new JMenuItem("Exit");
    item.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    System.exit(0);
    menu.add(item);
    mb.add(menu);
    dlframe.setJMenuBar(mb);
    public static void main(String[] args)
    DiveLog dl = new DiveLog();

    Classpath problem. Read the old threads related to in the classpath problem.
    /Sreenivasa Kumar Majji.
    Hi all,
    I am new to java and studying alone java from sun's
    site.Now i am going through sun's step by step
    programming.From there i got a packaged Application
    named DiveLog which i wrote and saved in divelog
    directory in jdk1.2.2which is in C directory.
    When i tried to compile it i got the error message as
    class Resource .java not found.But i have created the
    file Resource.java and saved in the same divelog
    directory.
    somehow i get rid of the error and looked for the
    directory but class file is not there.So i understood
    that Compilation doesn't took place.
    Can anyone help me to get rid of the error and compile
    and run the Application successfully.
    Here is the DiveLog application i have written.
    package divelog;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DiveLog
    private JTabbedPane tabbedPane;
    private JFrame dlframe;
    public DiveLog()
    dlframe = new JFrame("A Java(TM) Technology Dive
    Dive Log");
    dlframe.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0)
    tabbedPane = new
    e = new JTabbedPane(SwingConstants.LEFT);
    tabbedPane.setBackground(Color.blue);
    tabbedPane.setForeground(Color.white);
    populateTabbedPane();
    buildMenu();
    dlframe.getContentPane().add(tabbedPane);
    dlframe.pack();
    dlframe.setSize(765,690);
    dlframe.setBackground(Color.white);
    dlframe.setVisible(true);
    private void populateTabbedPane()
    tabbedPane.addTab("Welcome",
    null,
    new Welcome(),
    "Welcome to the Dive
    "Welcome to the Dive Log");
    tabbedPane.addTab("Diver Data",
    null,
    new Diver(),
    "Click here to enter
    "Click here to enter diver data");
    tabbedPane.addTab("Log Dives",
    null,
    new Dives(),
    "Click here to enter
    "Click here to enter dives");
    tabbedPane.addTab("Statistics",
    null,
    new Statistics(),
    "Click here to calculate
    "Click here to calculate dive statistics");
    tabbedPane.addTab("Favorite Web Site",
    null,
    new WebSite(),
    "Click here to see a web
    "Click here to see a web site");
    tabbedPane.addTab("Resources",
    null,
    new Resources(),
    "Click here to see a
    "Click here to see a list" + "of
    t" + "of resources");
    private void buildMenu()
    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem item = new JMenuItem("Exit");
    item.addActionListener(new
    istener(new ActionListener()
    public void actionPerformed(ActionEvent
    ed(ActionEvent e)
    System.exit(0);
    menu.add(item);
    mb.add(menu);
    dlframe.setJMenuBar(mb);
    public static void main(String[]
    d main(String[] args)
    DiveLog dl = new DiveLog();

  • How to compile and run ajax example

    I am having trouble trying to run this application in the latest jdev: (has 5 ones)
    http://www.oracle.com/technology/pub/articles/jellema-muir-adf.html
    Ajax and Partial-Page Refresh in Oracle ADF Rich Client
    codesamples
    code-sample ID S439: Sample code for Tech Article "Ajax and Partial-Page Refresh in Oracle ADF Rich Client", by Lucas Jellema and Chris Muir
    Just what are the steps to build and run one of these samples? I have been trying
    things and it's not working. So I know what doesn't work: (make a subdirectory in your jdev apps folder and unzip the
    package there).
    so if I open the first application .jws file, jdev wants to "migrate" it. Supposedly that was successful but I can't beyond
    the "run target" issue. What and where is the run target? I'd really appreciate a tip.

    unzip into a new directory.
    Open the *.jws file from that directory - this will migrate the project to the JDev version you are using.
    In the SHOP_1 application expand the Web Content node in the application navigator, right click the ProductAdvertisment_step1.jspx file and choose run.

  • How to compile and run the servelt

    how to the compile and run the servlet programmes and how should i deploy them
    and is there any site for the tomcat server free download

    your first question is too general. you'll need a tutorial a Hello World on a servlet...google it.
    for the second one go to [http://tomcat.apache.org]

  • Compile and run

    if I have a package how do I run it in command front;
    how should I give the comman to compile and run;

    package com.mycompany;
    public class MyClass { ... }
    javac com\mycompany\MyClass.java
    java -cp .com.mycompany.MyClasshttp://www.google.com/search?q=java+package+tutorial
    Javapedia: Classpath
    Setting the class path (Windows)
    How Classes are Found

  • Help:Compiling and running Java Midlets?

    Hello,
    I am a fresh learner in Java.I am finding it very difficult to compile and run Java Midlets on the Computer system.Also,i will like to tranfer the Sourcecodes to a PDA i.e install it on the PDA and have the application walking well.Please help.Thank you.

    You will get all the detailed steps ( have a look at the ff link) to configure the sun wireless toolkit on a PC , midlet compiling, running , uploading to the Palm PDA and testing it on the device. As for the connection, you can use the hot synch cable or a bluetooth hot synch.
    http://developers.sun.com/techtopics/mobility/midp/articles/palm
    Cheers!,
    Birhanu

  • Steps to compile and deploy files on jsap

    steps to compile and deploy files on jsap
    classpath that has to be set
    where to put the .class files
    (Where to fnd JNDI tab)

    jsas-sun java application Server
    I like to depoy servlet files on this server
    But it requires cloudscape to be started
    (database server)
    i have not even a single entry in the name of cloudscape

  • How to Compile and run Smart Card Application

    hi
    any one can help me reagrding Javacard API. i download the JavaCard Development Kit from sun and install on my machine but i didn't get all java files and class files of JavaCard API. where i obtain those files so my application get compile and run.
    pls help me i m new in this technology.
    Thanks in Advance.

    My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
    I've given my pgm and the thing I've got when I compiled it.
    Test.java
    package com.cert;
    public class Test
         public void display()
              System.out.println("Hai");
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files
    -cp <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
    Plz help me.
    thanks in advance
    Ambika

  • How to compile and run servlets in Eclipse?

    Does somebody known how can I compile and run servlets in Eclipse IDE? I've added and configured Tomcat's plugin. I've created a project with my example servlets source, and I don't know what farther. How do I have compile it without main method? I must add web.xml file from Tomcat's directory into projects in Eclipse and modify it?
    THX Chudzik

    Try googling for "eclipse servlet", surely someone has written instructions.

  • How can I compile and run other java classes from within an application?

    Hello there everyone! I really hope that someone can help me. I am writing a program that must be able to compile and run other java classes that are in different files, much like development environments like Kawa or Forte allow you to do.
    There has to be a way of doing this ( I hope!! ), but i can't seem to find it!!
    I have tried using this command to compile:
    Runtime.getRuntime().exec ("c:\\programs\\javac className.java");
    ...and this one to run:
    Runtime.getRuntime().exec ("c:\\programs\\java className");
    ...but neither works!!! I can compile and run classes that are in the same file as my application, but I can't get it to work at all for files in different directories or files.
    PLEASE, PLEASE, PLEASE help me - i've run out of ideas, and i need this to be working in 3 days!!!
    Thank you very much for any help anyone can give me, I really appreciate it!! Thanks again!!
    Adrian ( ...in distress!! )

    public class JavaCompiler{
       public static void main(String[] args)throws Exception{ //sorry bout the laziness
          if(args == null || args.length != 1){
             System.out.println("Usage: java JavaCompiler MyClass.java");
             System.exit(0);
          String className = args[0];
          Runtime rt = Runtime.getRuntime();
          Process p = rt.exec("javac " + className); //consider setting cpath for this
          p.waitFor();
          //now try to run after it is done.
          p = rt.exec("java " + className.substring(0, (className.length() - ".java".length()));
          p.waitFor();
          //do some other stuff
    }This should get you going. You may consider looking into the System.getProperty() method in order to determine the type of OS it is running on in order to findo out what command to run. I know that the sun tool listed above is nice, but by my understanding the sun tools provided are not guaranteed to stay the same. I'm no expert on this matter, but that is one of the reasons there is no API documentation for those tools. Also, I don't believe those tools come packaged with the JRE. (Of course if you are making an IDE it will be expected that the user has an sdk installed. Good luck with figuring this thing out.

  • How to Set up the  variables and others to compile and Run Java Programs

    Hello,
    I have just downloaded the jdk1.6.0_07 and jre1.6.0_07 and installed it in C:\Program files\Java in my Windows XP ,So please tell me how to sett up the enviroment variables etc to compile and run Java Programs from Command Prompt.
    thanks

    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
    1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
    2. Click Advanced > Environment Variables.
    3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin

  • How to compile and run java files on a mac using command line?

    can someone tell me or link me to some article on how to compile and run java files from command line on a mac? I have mac OS X leopard

    What do you mean by "where to put them" ? What do you want to put anywhere ?
    Have you read Peter's comment in brackets ? Perhaps you have a classpath problem ?
    Edited by: Michael_Knight on Aug 31, 2008 4:23 AM

  • How to compile and run package programs in Java

    Hi,
    I want to know how to compile and run the package programs in Java using -d. instead of creating the package folder manually.
    eg:
    package Test;
    class test1
    public void disp()
    //Any code;
    I want to compile this without creating the folder ' Test ' manually. that is if we use -d with javac the Test folder will be created automatically. I need the format of -d
    could anyone please help me.
    Thanks in Advance ,
    Ambika

    My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
    I've given my pgm and the thing I've got when I compiled it.
    Test.java
    package com.cert;
    public class Test
         public void display()
              System.out.println("Hai");
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files
    -cp <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
    Plz help me.
    thanks in advance
    Ambika

  • How to develope, compile  and run soap service

    we want to implement the soap sevice in our concern.So its very diffcult to develope the soap program.I dont know about the soap service.please give me a input about soap and how to develope soap programs.Pls also give some sample programs and how to compile and run those programs.In our concern we are using UNIX operating system.
    Thanking you
    Yours faithfully
    Saran

    You should start by posting questions regarding web services on the correct forum ;)
    Next go to xml.apache.org and read the documentation regarding Apache Axis.
    You could also take a look at the Spring Framework's support for web services.
    You could even take a look at the Sun Web Service tutorials.
    The above resources have plenty of examples and sample code.

Maybe you are looking for