Executing a Java --  program.class

1234JLG - Please help me resolve this hurdle. I do JAVAC and generate a Class, that I can display with NOTEPAD, but when I do JAVA, what I receive is ...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/object
Thank You So Much.

This is thrown if the Java Virtual Machine tries to load in the class and no definition of the class could be found.
Make sure the path to the class is correct or execute from same directory.

Similar Messages

  • Executing new Java Program

    Hey,
    So I'd like to be able to execute another java program.
    File directory = new File(".");
                try {
                    List<String> l = new ArrayList<String>();
                    l.add("Java "+directory.getCanonicalPath+"AnotherProject/bin/main.class");
                    ProcessBuilder pb = new ProcessBuilder(l);
                    pb.start();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }What am I doing wrong? I'm getting the error: "No such file or directory."
    Edited by: Moopz on Nov 8, 2010 1:01 AM

    That is entirely up to you! That will be your entry point. If you are able to think of you application as two parts one server, one client part and you have no problems building the separate parts into "working" applications, then their respective main methods would be good enough as start-methods. It's just a name.
    Really, the principle is as easy as this, Suppose you have a HelloWorld class (think Server) and a GoodbyeMoon class (think client) looking like:
    public class GoodbyeMoon {
         public static void main(String[] args) {
              System.out.println("Good bye, Moon!");
    }Then you're application can do this:
    public class LoginMain {
         public static void main(String[] args) {
                    // ... GUI to select MOON or WORLD
                    if (userSelection == MOON ) {
                          GoodbyeMoon.main(null);
                    } else {
                          HelloWorld.main(null);
    }

  • Batch prog to execute remote java program

    hi all
    i have one batch file which executes the local java program ....
    but i want to execute a java program in a remote machine....
    how do i do this..? kindly help

    Well this is what I do in Windows (I use XP but it works in others):
    First you have to make sure all the class files are in the same folder (duh)
    Then you copy your java.exe from your jre folder into the folder with all your class files.
    Finally, you create a shortcut to java.exe and add your class name to the command line on the shortcut.
    Now all you have to do is double click on the shortcut and your program runs. Sure it's not that pretty but it works.

  • How to execute a java program by clicking !?!?

    Just a click to execute a java program?!!
    Like the ".exe" in Windows or "x" permission in Unix ?!?!?!
    How can I do that?
    And how to set a java program file to display as a personal icon? (My Icon)
    :-)

    Well this is what I do in Windows (I use XP but it works in others):
    First you have to make sure all the class files are in the same folder (duh)
    Then you copy your java.exe from your jre folder into the folder with all your class files.
    Finally, you create a shortcut to java.exe and add your class name to the command line on the shortcut.
    Now all you have to do is double click on the shortcut and your program runs. Sure it's not that pretty but it works.

  • How to execute a Java program from ODI

    Hi All,
    I am new to ODI. I would like to know whether its possible to execute a java program from ODI.
    Reason for this is, I would like to write information in error tables into a file. And after that another program will mail that error log to concerned person.
    Could anyone please help me with this?
    Thank you in advance
    Regards,
    Srini

    if you have the java code then u can create a procedure with Java BeanShell as the Technology and write your java code in the procedure

  • Use ProcessBuilder to execute a java program with a file piped as input

    Hi,
    I am trying to execute a java program passing in input file as argument. I have to do this by forking a process and am using Processbuilder.
    I have a main function which calls the executeCliTopologyDesigner method. I get a Java I/O exception
    Caught IOException: Cannot run program "$JAVA_HOME/bin/java oracle.apps.fnd.provisioning.cli.TopologyDesigner ": java.io.IOException: error=2, No such file or directory
    Can you please let me know if I am missing something?
    Thanks,
    pkrish
    Code Snippet:
    private synchronized void executeCliToplogyDesigner(String cliCommand, File tmp)
    throws IOException, InterruptedException
    {    File temp= writeDataInTemp(compDefName);
    cliCommand = "$JAVA_HOME/bin/java oracle.apps.fnd.provisioning.cli.TopologyDesigner ";
    ProcessBuilder pb = new ProcessBuilder(cliCommand,"<",temp.getCanonicalPath());
    executeProcess(pb);
    Edited by: pkrish on Mar 2, 2009 3:56 PM
    Edited by: pkrish on Mar 2, 2009 3:57 PM
    Edited by: pkrish on Mar 2, 2009 3:58 PM
    Edited by: pkrish on Mar 2, 2009 3:59 PM

    Hi,
    I printed out the system environment variables PATH and CLASSPATH and it is as below:
    Classpath :/ade/prprasa_prov_latest/fmwtest/tools/orajtst/home/lib/orajtst.jar:/ade/prprasa_prov_latest/jdev/src/abbot/dist/EXTENSIONS
    Path :/ade/prprasa_prov_latest/fxtn/util/tools/ant/bin:/ade/prprasa_prov_latest/fmwtest/tools/orajtst/home/bin:/ade/prprasa_prov_latest/oracle/jdeveloper/jdev/bin:/ade/prprasa_prov_latest/javahome/jdk/bin:/usr/kerberos/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/ade/bin:/OracleProd/oracle10g/bin:/OracleProd/oracle10g/bin:/OracleProd/oracle10g/bin
    The Path does contain java.
    I changed my command as I need a different classpath.
    cliCommand = "/ade/prprasa_prov_latest/javahome/jdk/bin/java -classpath .:/ade/prprasa_prov_latest/oracle/provisioning/tools/lib/*:/ade/prprasa_prov_latest/oracle/provisioning/configframework/lib/*:/ade/prprasa_prov_latest/oracle/provisioning/framework/lib/*"
    Caught IOException: Cannot run program "/ade/prprasa_prov_latest/javahome/jdk/bin/java -classpath .:/ade/prprasa_prov_latest/oracle/provisioning/tools/lib/*:/ade/prprasa_prov_latest/oracle/provisioning/configframework/lib/*:/ade/prprasa_prov_latest/oracle/provisioning/framework/lib/*": java.io.IOException: error=2, No such file or directory
    Any ideas? Please let me know where do I post it if not here.

  • Problem while executing simple java program

    Hi
    while trying to execute a simple java program,i am getting the following exception...
    please help me in this
    java program :import java.util.*;
    import java.util.logging.*;
    public class Jump implements Runnable{
        Hashtable activeQueues = new Hashtable();
        String dbURL, dbuser, dbpasswd, loggerDir;   
        int idleSleep;
        static Logger logger = Logger.getAnonymousLogger();      
        Thread myThread = null;
        JumpQueueManager manager = null;
        private final static String VERSION = "2.92";
          public Jump(String jdbcURL, String user, String pwd, int idleSleep, String logDir) {
            dbURL = jdbcURL;
            dbuser = user;
            dbpasswd = pwd;
            this.idleSleep = idleSleep;
            manager = new JumpQueueManager(dbURL, dbuser, dbpasswd);
            loggerDir = logDir;
            //preparing logger
            prepareLogger();
          private void prepareLogger(){      
            Handler hndl = new pl.com.sony.utils.SimpleLoggerHandler();
            try{
                String logFilePattern = loggerDir + java.io.File.separator + "jumplog%g.log";
                Handler filehndl = new java.util.logging.FileHandler(logFilePattern, JumpConstants.MAX_LOG_SIZE, JumpConstants.MAX_LOG_FILE_NUM);
                filehndl.setEncoding("UTF-8");
                filehndl.setLevel(Level.INFO);
                logger.addHandler(filehndl);
            catch(Exception e){
            logger.setLevel(Level.ALL);
            logger.setUseParentHandlers(false);
            logger.addHandler(hndl);
            logger.setLevel(Level.FINE);
            logger.info("LOGGING FACILITY IS READY !");
          private void processTask(QueueTask task){
            JumpProcessor proc = JumpProcessorGenerator.getProcessor(task);       
            if(proc==null){
                logger.severe("Unknown task type: " + task.getType());           
                return;
            proc.setJumpThread(myThread);
            proc.setLogger(logger);       
            proc.setJumpRef(this);
            task.setProcStart(new java.util.Date());
            setExecution(task, true);       
            new Thread(proc).start();       
         private void processQueue(){       
            //Endles loop for processing tasks from queue       
            QueueTask task = null;
            while(true){
                    try{
                        //null argument means: take first free, no matters which queue
                        do{
                            task = manager.getTask(activeQueues);
                            if(task!=null)
                                processTask(task);               
                        while(task!=null);
                    catch(Exception e){
                        logger.severe(e.getMessage());
                logger.fine("-------->Sleeping for " + idleSleep + " minutes...hzzzzzz (Active queues:"+ activeQueues.size()+")");
                try{
                    if(!myThread.interrupted())
                        myThread.sleep(60*1000*idleSleep);
                catch(InterruptedException e){
                    logger.fine("-------->Wakeing up !!!");
            }//while       
        public void setMyThread(Thread t){
            myThread = t;
        /** This method is only used to start Jump as a separate thread this is
         *usefull to allow jump to access its own thread to sleep wait and synchronize
         *If you just start ProcessQueue from main method it is not possible to
         *use methods like Thread.sleep becouse object is not owner of current thread.
        public void run() {
            processQueue();
        /** This is just another facade to hide database access from another classes*/
        public void updateOraTaskStatus(QueueTask task, boolean success){
            try{         
                manager.updateOraTaskStatus(task, success);
            catch(Exception e){
                logger.severe("Cannot update status of task table for task:" + task.getID() +  "\nReason: " + e.getMessage());       
        /** This is facade to JumpQueueManager method with same name to hide
         *existance of database and SQLExceptions from processor classes
         *Processor class calls this method to execute stored proc and it doesn't
         *take care about any SQL related issues including exceptions
        public void executeStoredProc(String proc) throws Exception{
            try{
                manager.executeStoredProc(proc);
            catch(Exception e){
                //logger.severe("Cannot execute stored procedure:"+ proc + "\nReason: " + e.getMessage());       
                throw e;
         *This method is only to hide QueueManager object from access from JumpProcessors
         *It handles exceptions and datbase connecting/disconnecting and is called from
         *JumpProceesor thread.
        public  void updateTaskStatus(int taskID, int status){       
            try{
                manager.updateTaskStatus(taskID, status);
            catch(Exception e){
                logger.severe("Cannot update status of task: " + taskID + " to " + status + "\nReason: " + e.getMessage());
        public java.sql.Connection getDBConnection(){
            try{
                return manager.getNewConnection();
            catch(Exception e){
                logger.severe("Cannot acquire new database connection: " + e.getMessage());
                return null;
        protected synchronized void setExecution(QueueTask task, boolean active){
            if(active){
                activeQueues.put(new Integer(task.getQueueNum()), JumpConstants.TH_STAT_BUSY);
            else{
                activeQueues.remove(new Integer(task.getQueueNum()));
        public static void main(String[] args){
                 try{
             System.out.println("The length-->"+args.length);
            System.out.println("It's " + new java.util.Date() + " now, have a good time.");
            if(args.length<5){
                System.out.println("More parameters needed:");
                System.out.println("1 - JDBC strign, 2 - DB User, 3 - DB Password, 4 - sleeping time (minutes), 5 - log file dir");
                return;
            Jump jump = new Jump(args[0], args[1], args[2], Integer.parseInt(args[3]), args[4]);
            Thread t1= new Thread(jump);
            jump.setMyThread(t1);      
            t1.start();}
                 catch(Exception e){
                      e.printStackTrace();
    } The exception i am getting is
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe
    Exception in thread "main" ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
    JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [../../../src/share/back/util.c:820] Please help me.....
    Thanks in advance.....sathya

    I am not willing to wade through the code, but this portion makes me conjecture your using an Oracle connect string instead of a class name.
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe

  • How Can I execute a java program using java code?

    {color:#000000}Hello,
    i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
    {color}

    Thanks Manko.
    i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance

  • Unable to see the imported files in ODI after executing my java program

    Hi,
    I am using the following java code to import the physical topology into ODI11G.
    ===========================================================================
    ImportServiceImpl importService =
    new ImportServiceImpl(pOdiInstance);
    importService.importTopologyFromFolder(importService.IMPORT_MODE_SYNONYM_INSERT_UPDATE,FolderPath, true);
    ===========================================================================
    The above code went through fine while executing my program.But, i can't able to see the imported topology in ODI.
    Can you suggest me how to import the topologies as well as work repository into ODI through Java programming.
    Thanks in advance,
    Ganesh Kesavarapu

    I would do that as a last resort, as it happens to be a client server, I don't think they'd appreciate me needing to reboot a Unix server during the day. Would anyone have any other suggestions?
    I just removed the JSPs from the live server, and refreshed the page and Tomcat could not find the JSPs, so I'm sure I have the correct directory. I then made sure the .java and .class files were deleted from the work directory, uploaded my new files (again) and hit refresh... and yet again I was served the same code as always, when I view source it still shows me the old source code even though the JSP file and compiled java files and class show that the new file should be shown, not the old one.

  • Executing a JAVA program from a DOS prompt vs the START = RUN dialog

    Another novice programmer question...I hope you have the patience...
    I have a demo JAVA program that runs fine on my Windows PC when I execute it from a DOS prompt:
    K:\COMMON\ITS\STEVEB\java\WhileDemo>java WhileDemo
    Count is: 1
    Count is: 2
    Count is: 3
    Count is: 4
    Count is: 5
    Count is: 6
    Count is: 7
    Count is: 8
    Count is: 9
    Count is: 10Can I run this same command from the Windows START => RUN dialog? If I cut an paste the same command, 'K:\COMMON\ITS\STEVEB\java\WhileDemo>java WhileDemo', into the START => RUN dialog I get the following error:
    "Windows cannot find 'K:\COMMON\ITS\STEVEB\java\WhileDemo>java WhileDemo'. Make sure you have typed the name correctly, and then try again. To search for a file, click the Start button and then click Search."
    Is what I'm attempting to do even possible? Any insights would be greatly appreciated. Thanks.

    Will a .JAR keep the window from closing on exit? Nope... creating java-archives (jar's) is just the next step down the "how to publish my java application" road. You will eventually (almost certainly) need to progress that far... but there's no rush.
    Compiling to and running from class files will do for now.
    If you want a command prompt which stays open then open it yourself... Start ~ run: cmd (on NT, XP, Fista)
    See also: "cmd here" is one of the windows power toys: http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

  • Executing a Java Program from within a Java Program

    I need to execute the following Java Program from withing another Java Program. The office toolbar command line is
    D:\WINDOWS\system32\java.exe -cp E:\Development\Eclipse\UpdateServer\Classes -server -showversion UpdateServer
    I can find no combination of ProcessBuilder commands, including those that include "Cmd.exe /c" that will make this program run from within another Java Program. All the examples I can find only show how to run Windows *.exe programs. I keep getting error 123 from ProcessBuilder.start(), but I can find no documentation for error 123.

    Assuming your code didn't get mangled by the forum
    (it's missing one "), it may be that your "-cp
    E:\\Develop.." argument is getting quoted as it has a
    space in it; try passing "-cp" and "E:\\Develop..."
    as two arguments.That worked; specifically the following tested OK:
    ProcessBuilder pb = new ProcessBuilder("D:\\WINDOWS\\System32\\Java.exe", "-cp", "E:\\Development\\Eclipse\\UpdateServer\\Classes\\", "-server", "-showversion", "UpdateServer" );
    pb.directory(new File("E:\\Development\\Eclipse\\UpdateServer\\Classes\\"));
    try{
         Process p = pb.start();
         InputStream is = p.getErrorStream();
         InputStreamReader isr = new InputStreamReader(is);
         BufferedReader br = new BufferedReader(isr);
         String line;
         while ((line = br.readLine()) != null)
              System.out.println(line);
         p.waitFor();
    }catch(IOException ioe){
    I was sure I tried that exact same code before, and it did not work, but now it does, at least at the top level (when it is in main of a test program). I will have to wait to try it until later when it is buried deep in a subroutine.

  • Please help with executing a java program from another java program

    Hi, I have tried to execute a very simple java program which is printed out "Hello world" from another java gui program when the user click on the "START" button. However, I don't receive any print out on the terminal when they click it. These two programs are being developed in Unix environment. Here is the code that I am trying to use.
    Runtime r = Runtime.getRuntime();
    r.exec("java HelloWorld");
    p.s. HelloWorld is java class of the HelloWorld.java

    I think you have to luanch your MS Prompt first before executing the command.

  • Error while executing HelloWorld.java program

    Hi All,
    I am trying to execute the samples(HelloWorld.java) program from Jdeveloper and provided the following details in runtime.defaults:
    CONTENT_DB_URL
    ADMIN_USER_NAME
    ADMIN_USER_PASSWORD
    however getting the following exception:
    FdkException:
    Error Code: ORACLE.FDK.UnexpectedError
    Detailed Error Code: ORACLE.FDK.FeatureNotEnabled
    Trace Id:
    info (NamedValue[]): null
    can any one please help me to resolve this issue.
    Thanks
    Krrish.

    See the Cleartext Authentication note in the running_client_samples.html file of the CDB devkit.
    The default configuration for an out-of-box Oracle Content DB installation allows Cleartext Authentication only if SSL has been enabled (and the Web Services connection string begins with https). See the authentication topic for details.
    To allow Cleartext Authentication to take place over standard (non-SSL) HTTP, set the Oracle Content DB domain property IFS.DOMAIN.WS.CleartextAuthenticationRequiresHttps to false using Enterprise Manager (Application Server Control). See the Content DB Administration Guide for details.
    If the domain property above is not modified to false and Cleartext Authentication is attempted using using standard HTTP, an FdkException will be thrown:
    ORACLE.FDK.UnexpectedError : ORACLE.FDK.FeatureNotEnabled
    cheers
    Matt.

  • Not able to execute one Java program from another one via. exec()

    Hi,
    I am new to this forum, so I might be asking a very trivial quetion.
    My program Ap1 is :
    class Ap1
    public static void main(String a[]) throws Exception
    Runtime rt=Runtime.getRuntime();
    Process p=null;
    p=rt.exec("javac,Pr.java");
    Runtime.getRuntime().exec("javac,Pr.java");
    When I run the above program, I get below error at the line 7(bold one):
    D:\batchwe>javac Ap1.java
    D:\batchwe>java Ap1
    Exception in thread "main" java.io.IOException: CreateProcess: javac,Pr.java err
    or=2
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
    at java.lang.Runtime.exec(Runtime.java:591)
    at java.lang.Runtime.exec(Runtime.java:429)
    at java.lang.Runtime.exec(Runtime.java:326)
    at Ap1.main(Ap1.java:7)
    Path is set as below(which seems correct):
    D:\batchwe>path
    PATH=C:\Program Files\Java\jdk1.5.0_05\bin
    I am just wondering how to call one Java program from another one?!
    Please help.
    thanks
    Rashmi

    Hi diptaPB,
    Thanks for your suggestion.
    Here is how I tried it again, but not getting the desired output:
    Class Pr looks like below -->
    class Pr
    public static void main(String a[])
    System.out.println("hi from process");
    When I run 'Pr' from command prompt, i get the desired output:
    D:\batchwe>java Pr
    hi from process
    However, when I call 'Pr' from another program Ap2.java, it seems that it does not call 'Pr':
    class Ap2
    public static void main(String a[]) throws Exception
    Runtime rt=Runtime.getRuntime();
    Process p=null;
    String[] cmd=new String[2];
    cmd[0]="javac";
    cmd[1]="Pr.java";
    p=rt.exec("cmd");
    D:\batchwe>javac Ap2.java
    D:\batchwe>java Ap2
    ************* no output appears here***********************
    Looking forward for your help.
    regards
    Rashmi

  • Execute a java program from an another program

    Like we can compile a code from wihin a java file by using the following :
    Tool javac = ToolProvider.getSystemJavaCompiler();
    Similarly,can we execute i.e. run a java program from within a java file i.e. running d java command from within the java file ??If yes then please tell me how??

    suppose on the Unix box or from a Unix script ( korn, perl, bourne, bash) you can run the following java program
    java ${JAVA_OPTS} -jar ${GMR_APPS_DIR}/risk.jar -I -c ${COB} -r ${BATCH} -o ${XML_DIR}
    in java you can do the following :
    Runtime rt = Runtime.getRuntime();
              try {
                   Process process = rt.exec("java ${JAVA_OPTS} -jar ${GMR_APPS_DIR}/risk.jar -I -c ${COB} -r ${BATCH} -o ${XML_DIR}
    // OR
                   Process process = rt.exec("/export/apps/Tools/apache-tomcat-5.5.17/bin/startup.sh");
                   // process.destroy(); if you want to kill the process
                   process.waitFor();
                   int RC = process.exitValue();      
                   System.out.println(returnOutput(process.getErrorStream()));
                   System.out.println(returnOutput(process.getInputStream()));
              } catch (Exception ex) {
                   ex.printStackTrace();
    empty the output stream from the script
    private String returnOutput(InputStream is) throws Exception {
                   String s;
                   StringBuffer strBuff = new StringBuffer();
                   BufferedReader br = new BufferedReader(new InputStreamReader(is));
                   while ((s = br.readLine()) != null) {
                        strBuff.append(s);
                   return strBuff.toString();
              }You need to relace the ${} by the appropriate values.
    Regards,
    Alan Mehio
    London, UK
    Edited by: alan_mehio on Jan 16, 2008 4:21 PM

Maybe you are looking for

  • Issue in custom delegate control

    hi   am  creating a custom delegate control with controlid ="AdditionalPageHead" . i deployed and activated as a  site collection feature. but i am not sure how to see the activated control/  how to see this control in action. below is my code: using

  • Errors in OVS code

    Hi all,    Can someone help rectify errors in the below code. I can't able to run this code // This file has been generated partially by the Web Dynpro Code Generator. // MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end. // ALL OTHER CHANGE

  • Why doesn't "Always accept Cookies" actually always accept cookies?

    I have my security setting set to "Always" accept cookies but cookies are not being accepted for iframes and ajax connections.  Shouldn't a setting actually do what it says it does?  I also find it odd that I had cleared my cookies and 20 minutes lat

  • Overriding link auto update?

    Hi. A friend asked me to edit something in an indesign-file. He sent me the file but no images and all links where broken. No problem I was just editing som text. I did this and returned the file (I know it is not the way to work with indesign). He c

  • Im an unable to view "about this Mac". Can someone help please

    Im an unable to view "about this Mac". Can someone help please. I am running a new iMac but can't see the spec because i cannot open the relevant window