Results 1 to 14 of 14
  1. #1
    j0h@nb is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Question Main startup class

    I have a Flash application from which i call a few java executables that are supposed to open other programs/files etc. Works well from where i'm sitting, but one of my clients is having trouble with it. Whenever he clicks on a button that calls one of the java programs he receives an error that states: "The main startup class could not be found".

    Any ideas what could cause this?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Main class(actually class which has main method) may be missing. Check whether it is there first.

  3. #3
    j0h@nb is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default

    Yup, here's the code i'm using...

    Java Code:
    import java.util.*;
    import java.io.*;
    
    public class OpenFile
    {
    	public static void main(String args[])
    	{
    		
    		try{
    			String userdir = System.getProperty("user.dir");
    			
    			String parsedUserdir = userdir.substring(userdir.indexOf(":")-1,userdir.indexOf(":")).toLowerCase();
    			
    			String fileName;
    			
    			if(parsedUserdir.equals("c")){
    				fileName = "C:\\temp\\fscommand\\4400796_Diagnosfil_PropPlus_SE.P1D";
    			}else if(parsedUserdir.equals("d")){
    				fileName = "D:\\fscommand\\4400796_Diagnosfil_PropPlus_SE.P1D";
    			}else if(parsedUserdir.equals("e")){
    				fileName = "E:\\fscommand\\4400796_Diagnosfil_PropPlus_SE.P1D";
    			}else if(parsedUserdir.equals("f")){
    				fileName = "F:\\fscommand\\4400796_Diagnosfil_PropPlus_SE.P1D";
    			}else{
    				fileName = "G:\\fscommand\\4400796_Diagnosfil_PropPlus_SE.P1D";
    			}
    			
    			Runtime rt = Runtime.getRuntime();
    
    			Process proc1 = rt.exec( "cmd /C start "+ fileName );
    			proc1.waitFor();
    
    		}catch(Throwable t){
    			t.printStackTrace();
    		}
    	}
    }

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    This code is ok. If the correct file in correct drive/path it opens. So what is your issue here.

  5. #5
    j0h@nb is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default

    Well, one of my clients gets an error when running this. Works well on my machine, but as he runs it on his machine it says "The main startup class could not be found". Could it have something to do with his configuration? (security or whatever...?)

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    I don't think so. This application not deal with such security level. Is that your complete application run on an applet. If so the browser can't be support it. Specially in FF.

  7. #7
    j0h@nb is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default

    Forgot to mention...it's a standalone flash app, so it doesn't run from a browser. Runs from a CD or usb-drive.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Hmm, according to your error message, it wont be related with the wrong file path of the searching file. More possibility to missing the main class, the above class.

    You say that the application you have with is working. Can you test your working application on your clients' machine.

  9. #9
    j0h@nb is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default

    Turned out that they didn't allow JVM on their machines. Problem partially solved, now i just need another workaround. Thanks for the efforts. :-)

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by j0h@nb View Post
    Turned out that they didn't allow JVM on their machines.

    This is interesting. How did you find that JVM not allowed this.

  11. #11
    sandeepkk2005 is offline Member
    Join Date
    Nov 2007
    Posts
    18
    Rep Power
    0

    Default

    Have you put it in the executable jar file?
    If yes in manifest file you have to specify Main-Class name with full package name.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Great, yes it can be a reason. But if he use the same type of package on his message, it wont be happened.

  13. #13
    sandeepkk2005 is offline Member
    Join Date
    Nov 2007
    Posts
    18
    Rep Power
    0

    Default

    Package is not a problem in this case.
    It seems to problem with not specifying Main-Class attribute in Jar File.
    There is no other way this can happen.
    Program is correct.

  14. #14
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by sandeepkk2005 View Post
    Package is not a problem in this case.
    Sorry you don't get me. What I've mean by package is the whole project. Sorry for the confusing.

    Quote Originally Posted by sandeepkk2005 View Post
    It seems to problem with not specifying Main-Class attribute in Jar File.There is no other way this can happen.
    Program is correct.
    Yes the program is correct. Actually this is not the only issue on this. j0h@nb says that there is some issue with JVM.

Similar Threads

  1. Replies: 2
    Last Post: 09-22-2011, 10:48 PM
  2. Could not find the main class, program will exit.
    By aryubi in forum New To Java
    Replies: 39
    Last Post: 02-19-2010, 11:02 AM
  3. Calling a variable from main to another class
    By itsme in forum New To Java
    Replies: 1
    Last Post: 12-18-2007, 04:35 PM
  4. how to load a java class in startup
    By leonard in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 04:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •