
11-29-2007, 10:23 AM
|
|
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, 10:32 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
|
Main class(actually class which has main method) may be missing. Check whether it is there first.
|
|

11-29-2007, 12:23 PM
|
|
Member
|
|
Join Date: Nov 2007
Posts: 5
Rep Power: 0
|
|
Yup, here's the code i'm using...
|
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, 12:43 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
|
This code is ok. If the correct file in correct drive/path it opens. So what is your issue here.
|
|

11-29-2007, 12:56 PM
|
|
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, 01:05 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
|
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, 01:11 PM
|
|
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, 01:15 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
|
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, 05:05 PM
|
|
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, 04:47 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
Originally Posted by j0h@nb
|
|
Turned out that they didn't allow JVM on their machines.
|
This is interesting. How did you find that JVM not allowed this.
|
|

11-30-2007, 05:44 AM
|
|
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, 05:50 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
|
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, 06:35 AM
|
|
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, 06:44 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,473
Rep Power: 11
|
|
Originally Posted by sandeepkk2005
|
|
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.
Originally Posted by sandeepkk2005
|
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.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 11:44 AM.
|
|