Compiling ok, run error classdef of main ?

No error when compiling,
but when running I get: Exception in thread "main" java.lang.NoClassDefFoundError: test/java
everything worked yesterday. The only thing I added was:" " + (byte)(int)Math.pow(2,(int)87%8
here is test.java:
public class test
public static void main( String args[])
byte [] atest = {(byte)0x56,(byte)0x34,(byte)0x12,(byte)0x55};
System.out.println( intBcdBuffer2int(atest)+ " " + (byte)(int)Math.pow(2,(int)87%8));
static String oldasci(String strInput)
{ String back = "";
byte[] bBuffer = strInput.getBytes();
for(int i = 0; i < bBuffer.length; i++)
{bBuffer[i] = (byte)(bBuffer& 0x7F);}
for(int i = 0; i < bBuffer.length; i++)
{back = back + (bBuffer[i]& 0xFF);}
return back;
static byte bint2BcdByte(int int2Dig)
byte bToReturn = 0x00;
bToReturn = (byte)(int2Dig % 10);
bToReturn |= (byte)(((int2Dig-(int2Dig%10))/10)<<4);//tientallen
return bToReturn;
static int intBcdByte2Int( byte bBcd)
int intToReturn = 0;
intToReturn = (int)(bBcd & 0x0F); //eenheden
intToReturn = intToReturn + 10 *(int)(bBcd>>4); //tientallen
return intToReturn;
static byte[] bInt2BcdBuffer(int int16Dig)
{byte[] bBuffer = new byte[16];
for(int i = 0;( (((int16Dig/100) > 0) || ((int16Dig % 100) > 0))&&(i < bBuffer.length) ); i++)
{bBuffer[i] = bint2BcdByte((int16Dig % 100));
int16Dig = (int)(int16Dig - (int16Dig%100))/100;
return bBuffer;
static int intBcdBuffer2int(byte[] bBuffer)
{int intDig = 0;
    for(int i = 0; i < bBuffer.length; i++ )
      {intDig = intDig + (int)(intBcdByte2Int(bBuffer[i]) * Math.pow(10,(i*2)));}
return intDig;

you need to type "java Test" and not "java Test.java" (if your classpath settings are ok and you have compiled it it should run)

Similar Messages

  • 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();

  • Error Message: A main Java class needs to be specified to run the program.

    Hi,
    I am adding a program object to cms using java program, and trying to run it. I am getting an error message like
    Error Message: A main Java class needs to be specified to run the program.
    Could you please help me on this., please find the pasted program object pasted below
    public class MoveReports   {
    public void run(IEnterpriseSession enterpriseSession, IInfoStore infoStore,
                   String[] args) throws SDKException {
        int objectSize = ;
        String cms = "";
         String username = "";
         String password = "";
         String auth = "";
        try {
              ISessionMgr sm = CrystalEnterprise.getSessionMgr();
             enterpriseSession = sm.logon(username, password, cms, auth);
             IInfoStore oInfoStore=(IInfoStore)enterpriseSession.getService("", "InfoStore");
                 IInfoObjects iObjects = null;
                   iObjects = oInfoStore.query("Select * from CI_INFOOBJECTS where SI_PARENTID = 44104 AND SI_PROGID LIKE '%CrystalEnterprise.Excel%'");
                   // Getting total number of reports
                   objectSize = iObjects.size();
                   if(objectSize > 0)
                        for (int count = 0; count < objectSize; count++)
                             IInfoObject obj = (IInfoObject) iObjects.get(count);
                             // Specify the Destination parent Id to move the reports
                             obj.setParentID(44102);
                        oInfoStore.commit(iObjects);
                        System.out.println("Reports Moved Successfully");
                   else
                        System.out.println("Reports Not Available");
             catch (SDKException e) {
                 e.printStackTrace();
                 System.out.println("Error : " + e.getMessage());
    Thanks&Regards
    Damodar
    Edited by: Damodaram B on Nov 2, 2009 1:29 PM

    There's couple of things at issue here - you've not specified the proper interface (IProgramBase or IProgramBaseEx), and the program job server can't find the class in question (a deployment issue).
    You may want to open a support ticket with SAP.
    Sincerely,
    Ted Ueda

  • Any way to run the processor before the compiler throws an error?

    Hi,
    I want to generate code for an annotation @OverrideAll that would implement all the interface I methods with some default body.:
    Example
    interface I {
      void method();
    @OverrideAll
    class A implements I {
    }would have to generate code like this:
    class A_gen implements I {
      public void method() {
    class A extends A_gen {}However, I have the problem that the original source file does NOT compile because the interface I is not implemented, and as such, the annotation processor never runs. My question is:
    Is there any way I could force the annotation processor to run before the compiler shows the error? Or at least some way to supress this error message and give a chance to the annotation processor to run?
    TIA,
    Gabriel

    belingueres wrote:
    Hi,
    Thanks for answering so soon.
    I would prefer not to name the generated class in the original source code. As an alternative I thought to rather generate a subclass, but then there is the instantiation problem (can&acute;t do it without creating a factory method in class A and making it abstract, and indeed again need to name the generated class):
    @OverrideAll
    abstract class A implements I {
    public static A create() {
    return new A_gen();
    // generated class
    class A_gen extends A {
    public void method() {
    }so it seems I reached a dead end here.
    It would really help if (using the superclass generation as originally posted) I could change in the processor the superclass of class A to be A_gen, but it would require AST rewritting and I guess it is not a good option (if at all possible.)Belingueres,There are two ways to do what you want. You can either generate a superclass of A, or a subclass of A.
    If you generate a superclass, you need to specify the generated superclass's name in the extends clause of A. But you said "I would prefer not to name the generated class in the original source code", but give no reasons then go off exploring the second alternative.
    If you generate a subclass of A, then you need a way for the rest of the code to instantiate As without really knowing about the subclass, so you do in fact need a factory method in A which actually returns A_gens.
    I suggest you revisit your preference for not naming the generated class, and work out why you have that preference, and whether it is actually a sound engineering constraint, an aesthetic nicety (maybe in terms of not wanting the implemention strategy to be brought to the surface) or something emotional.
    You can do what you want with annotation processing, but you must choose between naming the generated superclass in the extends, or having an factory method that names the subclass.
    A related issue is that if you generate the superclass, the annotation processor can pick up the name of the class to be generated from the "extends" clause, and you therefore don't need to specify it any other way, whereas if you generate a subclass, the annotation processor cannot infer the name of the subclass that is being instantiated from the factory method (unless you use non standard APIs in your annotation processor), which means you need to explicitly name it as an attribute of the annotation.
    I have a preference for generating a superclass because that imposes less restrictions on whatever else you do with the class, and less of the code generation implementation details leak up into the class's signature.
    Also note when generating a superclass, if you want to extend something other than Object, then you need to specify that as an annotation value, usually as a Class<?>.
    Bruce

  • CVI 2013 Error: The compiler has run out of memory.

    Hello,
    I get this error in a source file I'd like to debug:
    1, 1 Error: The compiler has run out of memory.
    1, 1 Note: You may be able to work around the problem:
    1, 1 A. Set the debugging level to 'no run-time checking'.
    1, 1 B. Split your source file into smaller files.
    1, 1 C. Enable the 'O' option for your source file in the project.
    1, 1 D. Move large static data structures into new files and
    1, 1 enable the 'O' option for the new files.
    Options A and C disable debugging aids mostly, and I don't dare editing it.
    So any possibility to increase the memory limit?
    /* Nothing past this point should fail if the code is working as intended */
    Solved!
    Go to Solution.

    This is the "strange code"
    #pragma pack (push,8)
    typedef struct
    int struct1int;
    } STRUCT1;
    typedef struct
    STRUCT1* s1_ptr;
    } STRUCT2;
    typedef struct
    char c[2];
    int i;
    STRUCT2 s2;
    } STRUCT3;
    #pragma pack (pop)
    static STRUCT3 s3_global;
    void SomeFunc(void)
    s3_global.i = 0;
     I believe clang fails to compute the struct paddings.
    /* Nothing past this point should fail if the code is working as intended */

  • VSM-BC4J IN JDEV9042:compile error at JClient and run error at JSP

    compile error at JClient:
    C:\VSM-BC4J\src\oracle\otnsamples\vsm\client\admin\profilePanal.java
    --! Wraning(424,18):method setNextFocusableComponent(java.awt.Component) in class javax.swing.JComponent has been deprecated
    --! Wraning(425,20):method setNextFocusableComponent(java.awt.Component) in class javax.swing.JComponent has been deprecated
    --! Wraning(428,21):method setNextFocusableComponent(java.awt.Component) in class javax.swing.JComponent has been deprecated
    --! Wraning(430,13):method setNextFocusableComponent(java.awt.Component) in class javax.swing.JComponent has been deprecated
    run error at JSP:
    503 Service Unavailable
    Servlet error:Parsing error processing resource path

    Solution: don't use a runtime expression for the id attribute.
    The id attribute is used to declare
    - an attribute in scope
    - a scriptlet variable on the page
    These are only available for the duration of the <logic:iterate> tag
    The "id" is only used in your programming. You don't need to make it dynamic.

  • 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)

  • How to compile and run a java program?

    I am getting this error message, what to do?
    Exception in thread "main" java.lang.NoClassDefFoundError:
    Thanks for you help.
    Ajay

    Hello,
    I believe that this error is caused because when you
    compile and run a java program, you have to use the
    same name that is next to public class. For example,
    the program name is next to the word public class.
    For example, if a program began like this:
    public class Concat
    then the name of the program in this case is Concat
    and when you compile it you type: javac Concat.java
    when you run it type: java Concat
    depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
    Also depending on if you set your class path you might
    have to type the above like this: jdk1.2.1\bin\javac
    Concat.java to compile, and to run you would have to
    type jdk1.2.1\bin\java Concat where you would replace
    Concat with the name of your program and replace
    jdk1.2.1 with the name of your version of java, that
    is again if you do not have your classpath set. Hope
    this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
    Also, make sure you did not forget to put:
    public static void main(String[ ] args)
    on the line underneath the line where it says "public
    class Concat" where Concat is the name of your
    program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
    OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line.

  • 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

  • Problems compiling and running a servlet

    I have been trying to compile and run my servlet program to no avail. Please help. I am using Tomcat 5.5 and j2sdk1.4.2
    These are the errors I keep getting. I have already set the classpath appropriately.
    MyServletTest.java:5: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    MyServletTest.java:6: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    MyServletTest.java:10: cannot resolve symbol
    symbol : class HttpServlet
    location: class MyServletTest
    public class MyServletTest extends HttpServlet {
    ^
    MyServletTest.java:13: cannot resolve symbol
    symbol : class HttpServletRquest
    location: class MyServletTest
    public void doGet (HttpServletRquest req, HttpServletResponse resp)
    ^
    MyServletTest.java:13: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class MyServletTest
    public void doGet (HttpServletRquest req, HttpServletResponse resp)
    ^
    MyServletTest.java:48: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class MyServletTest
    private void printResultSet (HttpServletResponse resp, ResultSet rs)
    throws SQLException {
    ^
    MyServletTest.java:52: cannot resolve symbol
    symbol : method prinln (java.lang.String)
    location: class java.io.PrintWriter
    out.prinln("<html>");
    ^
    7 errors

    Thank you. I have managed to compile the program but
    when I run it I get:
    Exception in thread "main"
    java.lang.NoSuchMethodError: main
    How should I run a servlet?Servlets are not run like applications. You need to deploy them to a servlet container, and they get invoked and initialized by constructor, init() method and goGet/doPost().

  • Compile and Run From Windows Cmd Line?

    Hey,
    I have a Java project that I've created and run successfully from within Eclipse IDE. Now, I'm trying to compile and run from the command line so I don't have to depend on Eclipse. I can't seem to get it to work. I get tons of classpath looking errors.
    Is there a way to use Eclipse such that it will show you the correct synatx to run the project from the command line?
    Can anyone help me with this?
    My project structure is:
    MyProject
    ------src
    ---------------File1.java
    ---------------File2.java (main class)
    ------lib
    ---------------someFile1.jar
    ---------------someFile2.jar

    MyProject
    ------src
    ---------------File1.java
    ---------------File2.java (main class)
    ------lib
    ---------------someFile1.jar
    ---------------someFile2.jar
    try:
    c:\basedir> javac -classpath .;lib\someFile1.jar;lib\someFile2.jar src\*.java
    c:\basedir> java -cp .;lib\someFile1.jar;lib\someFile2.jar src.File2

  • Running errors - still unsolved

    i am getting a runtime error when i run java programs with java command.
    i'm using JDK1.4 beta version. the program is compiling smoothly. the error is when running it. i've set all corresponding paths for sure and it's working on other computers.
    the following is one program that i tried:
    import java.io.*;
    class App
    { public static void main(String[] args)
    { System.out.println("HEllo");
    the error i got was as follows:
    Exception in thread "main" java.lang.NoClassDefFoundError: App
    the file name for saving was also App.java
    all other programs are showing the same error......can any one help me out of this....... :(

    It's probably your classpath. The programme sounds like the one in all the books that everyone does first. Getting your first java program to work can be such a drag - we've all been there.
    Assuming your running a windows OS
    1. Go to start
    2. Click on run
    3. Type in sysedit
    4. The top file should be your 'auto-execute bat' file
    5. This is where you need to enter a path so that your DOS shell knows where to look to compile and run your creations
    On my computer it is;-
    set JAVA_HOME=C:\jdk1.3.1
    PATH C:\WINDOWS;C:\WINDOWS\WINDOWS;C:\DOS;C:\jdk1.3.1\BIN
    You probably have a more recent version than me so change this bit
    "jdk1.3.1" to "j2sdkee1.4" or whatever it is you downloaded from the web or CD, then restart your computer and try compiling your program again.
    As the previous submission says, in order to have program to run the compiler: alias 'javac' has to have created a classfile, so when you type;-
    jdk1.4.1>javac myProgramme.java
    If there are no errors it blinks a couple of times and then does this
    jdk1.4.1>
    Apparently nothing, but it means your code has been compiled. Then when you type;-
    jdk1.4.1>java myProgramme
    Hello World
    it should return the string value from System.out.println("some words");
    Hope this sets you on your way and welcome to java!

  • RUNJAVA error "No method main"

    Please help!
    Write simple java code:
    import java.io.*;
    public class test_01 {
    public static void main(String args[]) {
    try {
    System.out.println("test0");
    } catch(Exception e) {
    System.out.println(e.toString());
    e.printStackTrace();
    Then compile and copy class to Essbase Application Server
    Then try to write Calc Script:
    runjava test_01
    When I try to start this script get error:
    Error: 1200456 Problem running [test_01]: [No method main in test_01]
    Why I get error No method main ?
    Thanks.
    Edited by: user10621038 on Jun 8, 2009 5:19 AM

    Hi,
    If you are going to create a CDF you will need the following main constructor
    public static void main(com.hyperion.essbase.calculator.Context ctx, String[] args) {
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • 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.

Maybe you are looking for

  • Final Cut Pro X: Can't find project I was working on after closing the program

    Recently, I was working on a video in Final Cut, and I had to close it to do something. When I re-opened it, the project I was working on was not there. I have tried looking for folders storing the project, and have found nothing. Any suggestions?

  • Any known fixes for these rendering errors?

    So I took over a project of a previous video editor for work and this project is having errors rendering.   There are 2 Premiere Pro Projects, A and B.  I'm trying to render out about 9 sequences from each project.  I tried using AME, but It hung on

  • InfoCube Error Message: Choose a change request with target system BWQ

    Hi experts, I have a problem when I want to edit an InfoCube created by other developer. The error message received is as follow: "<b>Choose a change request with target system BWQ</b>". When I click on the Documentation (F9) button, the detailed mes

  • Report Designer - Formatting in paper layout

    Hello, I have been struggling with a request to develop a very detailed report in printed (paper Layout) format. I am OK with the data output, but spending too much time trying to get the graphical formatting to an acceptable level. Does anyone have

  • SONY RX1R AND CAMERA RAW

    I just purchased a great little camera the Sony RX1R unfortunatly iPhoto/Aperture will not process the RAW output.  Anyone out ther know when Apple will support this camera?  I cannot figure out how and where to ask Apple this question.  Thank you.