Results 1 to 14 of 14
Thread: Main startup class
- 11-29-2007, 09:23 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
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?
- 11-29-2007, 09:32 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Main class(actually class which has main method) may be missing. Check whether it is there first.
- 11-29-2007, 11:23 AM #3
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
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(); } } }
- 11-29-2007, 11:43 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This code is ok. If the correct file in correct drive/path it opens. So what is your issue here.
- 11-29-2007, 11:56 AM #5
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
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...?)
- 11-29-2007, 12:05 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 11-29-2007, 12:11 PM #7
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
Forgot to mention...it's a standalone flash app, so it doesn't run from a browser. Runs from a CD or usb-drive.
- 11-29-2007, 12:15 PM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 11-29-2007, 04:05 PM #9
Member
- Join Date
- Nov 2007
- Posts
- 5
- Rep Power
- 0
Turned out that they didn't allow JVM on their machines. Problem partially solved, now i just need another workaround. Thanks for the efforts. :-)
- 11-30-2007, 03:47 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 11-30-2007, 04:44 AM #11
Member
- Join Date
- Nov 2007
- Posts
- 18
- Rep Power
- 0
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.
- 11-30-2007, 04:50 AM #12
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Great, yes it can be a reason. But if he use the same type of package on his message, it wont be happened.
- 11-30-2007, 05:35 AM #13
Member
- Join Date
- Nov 2007
- Posts
- 18
- Rep Power
- 0
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.
- 11-30-2007, 05:44 AM #14
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Error: Could Not Find Main Class. Program Will Exit
By silvia in forum New To JavaReplies: 2Last Post: 09-22-2011, 09:48 PM -
Could not find the main class, program will exit.
By aryubi in forum New To JavaReplies: 39Last Post: 02-19-2010, 10:02 AM -
Calling a variable from main to another class
By itsme in forum New To JavaReplies: 1Last Post: 12-18-2007, 03:35 PM -
how to load a java class in startup
By leonard in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 03:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks